diff --git a/scripts/jquery.parallax-1.1.3.js b/scripts/jquery.parallax-1.1.3.js index f3569dc..10bf0da 100644 --- a/scripts/jquery.parallax-1.1.3.js +++ b/scripts/jquery.parallax-1.1.3.js @@ -19,7 +19,9 @@ http://www.gnu.org/licenses/gpl.html windowHeight = $window.height(); }); - $.fn.parallax = function(xpos, speedFactor, outerHeight) { + $.fn.parallax = function(xpos, ypos, speedFactor, outerHeight) { + + var $this = $(this); var getHeight; var firstTop; @@ -59,7 +61,14 @@ http://www.gnu.org/licenses/gpl.html return; } - $this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); + if(typeof ypos != 'undefined') { + calc = firstTop - pos + ypos; + } + else { + calc = firstTop - pos; + } + + $this.css('backgroundPosition', xpos + " " + Math.round((calc) * speedFactor) + "px"); }); }