I'd like my website's background to feature a horizontal (rather than vertical) parallax effect when scrolling horizontally. The following jQuery code was used by me for making a vertically scrolled website; I've tried to make some changes to make it work horizontally, but unfortunately had no luck.
$(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 });
        });
    });
});
 
     
     
     
    