Created
April 1, 2013 16:11
-
-
Save afeld/5285885 to your computer and use it in GitHub Desktop.
kittenbomb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var kittenize = function(){ | |
$('.fillmoreInner:not(.kitten)').each(function(i, el){ | |
var $el = $(el); | |
var url = 'url("http://placekitten.com/' + $el.width() + '/' + $el.height() + '")'; | |
$el.css('background-image', url); | |
$el.addClass('kitten'); | |
}); | |
$('img:not(.kitten)').each(function(i, el){ | |
var $el = $(el); | |
var url = 'url("http://placekitten.com/' + $el.width() + '/' + $el.height() + '")'; | |
$el.css('src', url); | |
$el.addClass('kitten'); | |
}); | |
}; | |
var debounced = _.debounce(kittenize, 300); | |
debounced(); | |
$(document).ajaxStop(debounced); | |
$('body').on('load', 'img', debounced); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment