Hello, I am setting the background image position in CSS, but when I start to scroll the parallax code seems to be resetting the y-position to 0.

here is the parallax code I'm using:

$(document).ready(function(){
$('section[data-type="background"]').each(function(){
var $bgobj = $(this); // assigning the object

$(window).scroll(function() {
var yPos = -($(window).scrollTop() / $bgobj.data('speed'));

// background position
var coords = '50% '+ yPos + 'px';

// Move the background
$bgobj.css({ backgroundPosition: coords });
});
});
});


Any suggestions as to how to get it to stop resetting the value I set in CSS?

Cheers!