Skip to content
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
21 changes: 20 additions & 1 deletion js/jquery.parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,26 @@

port.elem.on(events);
port.layers = port.layers? port.layers.add(node): jQuery(node);


// Initialize this layer at the defined x/y origins now. Subsequent calls to this "pointerFn" will happen
// via the Timer class in repeated calls to the frame() function as the mouse either enter/leaves the
// viewport (a.k.a. "mouseport").
pointerFn(
// Pointer relative position (0 to 1), x and y. Usually in the middle (i.e. 0.5, 0.5)
[options.xorigin, options.yorigin],
[0, 0], // Pointer relative position we're trying to animate to (0 to 1), x and y.
port.threshold,
0, // Decay, which we want to override so we initialize immediately.
parallax,
targetFn,
updateCss
);

// Also if the mouse happens to already be over the viewport, trigger an initial "mouseenter" now (since
// otherwise user would need to move mouse completely out of the viewport and then back in, in order to
// initialize the effect when it should already be started).
if (elem.is(':hover')) elem.mouseenter();

/*function freeze() {
freeze = true;
}
Expand Down