I am seeking to create a unique parallax effect on my website's background that scrolls horizontally instead of vertically. I attempted to make adjustments to the jQuery code below, which was originally for vertical scrolling, but was unsuccessful in achieving the desired effect.
$(document).ready(function(){
var $window = $(window);
$('section[data-type="background"]').each(function(){
var $bgobj = $(this);
$(window).scroll(function() {
var yPos = -( ($window.scrollTop() - $bgobj.offset().top) / $bgobj.data('speed'));
var coords = '50% '+ yPos + 'px';
$bgobj.css({ backgroundPosition: coords });
});
});
});