Created
February 7, 2016 20:16
-
-
Save nimaparsi/fbda8d0f7cbd6a9c9424 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
var $window = $(window); | |
$window.on('scroll', function () { | |
var y1 = $(window).scrollTop(); | |
var content = $('.cus_des .foreground'); | |
var change = parseInt(y1 * -0.19, 10); | |
content.filter(function () { | |
var thisContent = $(this); | |
return thisContent.offset().top < (y1 + $(window).height()) && thisContent.offset().top + thisContent.height() > y1; | |
}).css({ | |
'background-position': 'center ' + change + 'px' | |
}); | |
}); // Ends Scroll |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment