Created
April 1, 2014 10:46
-
-
Save mkwebworker/9911700 to your computer and use it in GitHub Desktop.
This file contains 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
////// FIX CHROME BG FLICKERING BUG //////////// | |
if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1) { | |
// set background-attachment back to the default of 'scroll' | |
jQuery('.parallax-1').css('background-attachment', 'scroll'); | |
// move the background-position according to the div's y position | |
jQuery(window).scroll(function(){ | |
scrollTop = jQuery(window).scrollTop(); | |
photoTop = jQuery('.parallax-1').offset().top; | |
distance = (photoTop - scrollTop); | |
jQuery('.parallax-1').css('background-position', 'center ' + (distance*-1) + 'px'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment