Skip to content
This repository was archived by the owner on Jul 27, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions scripts/jquery.parallax-1.1.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ http://www.gnu.org/licenses/gpl.html
windowHeight = $window.height();
});

$.fn.parallax = function(xpos, speedFactor, outerHeight) {
var $this = $(this);
$.fn.parallax = function(xpos, speedFactor, outerHeight, staticImage) {
var $this = $(this);
var getHeight;
var firstTop;
var paddingTop = 0;
Expand All @@ -43,7 +43,8 @@ http://www.gnu.org/licenses/gpl.html
// setup defaults if arguments aren't specified
if (arguments.length < 1 || xpos === null) xpos = "50%";
if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
if (arguments.length < 3 || outerHeight === null) outerHeight = true;
if (arguments.length < 3 || outerHeight === null || typeof outerHeight === 'string') outerHeight = true;
if (arguments.length < 4 || staticImage === null) staticImage = false;

// function to be called whenever the window is scrolled or resized
function update(){
Expand All @@ -59,7 +60,12 @@ http://www.gnu.org/licenses/gpl.html
return;
}

$this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
if (staticImage == true) {
$this.css('top', Math.round((firstTop - pos) * speedFactor) - 100 + "px");
} else {
$this.css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
}

});
}

Expand Down