Skip to content

Instantly share code, notes, and snippets.

Created September 20, 2015 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a8ba343eb6151c106dcb to your computer and use it in GitHub Desktop.
Save anonymous/a8ba343eb6151c106dcb to your computer and use it in GitHub Desktop.
/*--------------------------------------------------------------------------
Background Fit The Screen Snippet (v0.28+)
/*------------------------------------------------------------------------*/
A.BackgroundFillSnippet = {
autoLoad: function() {
if (document.styleSheets[0].cssRules===undefined) return;
var $s = jQuery('.full.slides:has(li)'); if (!$s) return;
$s.addClass('cover').children().each(function(i){
var $li = jQuery(this);
var imgSrc = $li.children('img').css('opacity', 0).attr('src');
$li.css({
'background-image': 'url(' + imgSrc + ')',
'background-position': 'center center',
'background-size': 'cover'
});
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment