Skip to content

Instantly share code, notes, and snippets.

@leocunhadev
Created March 30, 2020 02:55
Show Gist options
  • Save leocunhadev/ce0aff7bee018f95d8c8001f89c3b040 to your computer and use it in GitHub Desktop.
Save leocunhadev/ce0aff7bee018f95d8c8001f89c3b040 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function(){
$(window).scroll(function(e){
parallaxScroll();
});
function parallaxScroll(){
var scrolled = $(window).scrollTop();
$('#parallax-bg-1').css('top',(0-(scrolled*.10))+'px');
$('#parallax-bg-2').css('top',(0-(scrolled*.4))+'px');
$('#parallax-bg-3').css('top',(0-(scrolled*1))+'px');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment