Parallax image starting point
Permalink
Hello,
I'm building a site that has a parallax image on the homepage, but I can't seem to figure out how to start the background-position where I want to.
When the page loads, and you're at the very top, the background-position is:
I want it to start at:
My js for this is:
Any help is much appreciated!
Thanks
Kurtopsy
I'm building a site that has a parallax image on the homepage, but I can't seem to figure out how to start the background-position where I want to.
When the page loads, and you're at the very top, the background-position is:
background-position: 50% 0;
I want it to start at:
background-position: 50% 139px;
My js for this is:
$(document).ready(function(){ $window = $(window); $('section[data-type="background"]').each(function(){ var $scroll = $(this); $(window).scroll(function() { var yPos = -($window.scrollTop() / $scroll.data('speed')); var coords = '50% '+ yPos + 'px'; $scroll.css({ backgroundPosition: coords }); }); }); });
Any help is much appreciated!
Thanks
Kurtopsy