kaniosrn-j
9/10/2017 - 9:13 AM

Parallax Effect

SImple Parallax Effect using jQuery

$section[data-type="background").each(function() { 
  $bgobj = $(this); // assigning the object 
  $(window).scroll(function() { 
    var yPos = -($window.scrollTop() / $bgobj.data('speed')); 
  }); 
}); 
 var coords = '50% '+ yPos + 'px'; 
 $bgobj.css({ backgroundPosition: coords 1); 
1); 


// USEAGE
<section data-type="background" data-speed="5"></scetion>