Skip to content

Instantly share code, notes, and snippets.

var refresh = setInterval(function(){var button = document.querySelector('.home-map-scan');if (button && !button.classList.contains('is-on-cooldown')) {button.click();}},10000);
@Phil-B
Phil-B / jquery.iFrameAutoHeight.js
Created June 7, 2011 14:30
Auto-resize a same-domain iframe to the height of it's content
(function($) {
$.fn.extend({
iFrameAutoHeight: function() {
return this.each(function() {
var obj = $(this);
obj.height(0); //avoid flash at full height
if (obj.contents().find('body').height() > 0) { // already loaded - from cache (ie only)
resize(obj);
} else {
obj.load(function() {
// $('img.photo',this).imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// mit license. paul irish. 2010.
// webkit fix from Oren Solomianik. thx!
// callback function is passed the last image to load
// as an argument, and the collection as `this`