jQuery(function() { // Cache the Window object var $window = jQuery(window); // Parallax Backgrounds // Tutorial: http://code.tutsplus.com/tutorials/a-simple-parallax-scrolling-technique--net-27641 jQuery('section[data-type="background"]').each(function(){ var $bgobj = jQuery(this); // assigning the object jQuery(window).scroll(function() { // Scroll the background at var speed // the yPos is a negative value because we're scrolling it UP! var yPos = -($window.scrollTop() / $bgobj.data('speed')); // Put together our final background position var coords = '50% '+ yPos + 'px'; // Move the background $bgobj.css({ backgroundPosition: coords }); }); // end window scroll }); });