Skip to content

Instantly share code, notes, and snippets.

@afeld
Created April 1, 2013 16:11
Show Gist options
  • Save afeld/5285885 to your computer and use it in GitHub Desktop.
Save afeld/5285885 to your computer and use it in GitHub Desktop.
kittenbomb
$(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