Skip to content

Commit

Permalink
FIX for stephband#87: Ensure each layer is initialized properly at co…
Browse files Browse the repository at this point in the history
…rrect origin x/y on page load.
  • Loading branch information
patricknelson committed May 10, 2016
1 parent 36f695c commit a470d69
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion js/jquery.parallax.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,21 @@

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
);

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

0 comments on commit a470d69

Please sign in to comment.