Skip to content

Instantly share code, notes, and snippets.

@rendfall
Created April 13, 2015 09:03
Show Gist options
  • Select an option

  • Save rendfall/fd81bfcedb8bfa5ed9a0 to your computer and use it in GitHub Desktop.

Select an option

Save rendfall/fd81bfcedb8bfa5ed9a0 to your computer and use it in GitHub Desktop.
Preloader helper
var getPreloader = function(dest, options){
options = $.extend({
alt: '',
css: {
display: 'block',
margin: '30px auto'
},
src: '/assets/ajax_loaders/loader-big.gif'
}, options);
var $img = $('<img>', options);
if(dest && dest.length){
dest.html($img);
return true;
} else {
// return as string
return $img[0].outerHTML;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment