Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Store the actual starting positions. #46

Merged
merged 1 commit into from

2 participants

@magebarf

If mouse pointer is positioned at middle of screen when activating Plax, if there is any margin applied to any elements they will make a "leap" upon first plaxifier update.

This seems to stem from the offsetLeft and offsetTop not taking the margin into consideration, which the jQuery .position() values does.

Clearest example of this I've found is the GitHub error 500 page, where the "Ooops" text has a 10px margin defined. Positioning the mouse pointer near the middle of the page, and reloading the page, all elements but the text layer can be made to stay roughly in the same place, but the text layer will always make a jump, of roughly 10 pixels.

@magebarf magebarf Improve starting position.
If mouse pointer is positioned at middle of screen, this will not make the layers jump on first position update.
075936c
@magebarf

Thought I'd sent the last of my findings over. :)

This will most probably be the last pull request from my end for a while.

@cameronmcefee cameronmcefee merged commit bf9dff5 into cameronmcefee:master
@cameronmcefee

Nice! Thanks for your contributions. They're much appreciated.

@magebarf

Thanks for an awesome plugin to start off with! It's just the right level of complexity and features, and the execution and experience is great! :+1:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 1, 2013
  1. @magebarf

    Improve starting position.

    magebarf authored
    If mouse pointer is positioned at middle of screen, this will not make the layers jump on first position update.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 js/plax.js
View
4 js/plax.js
@@ -88,8 +88,8 @@
'right' :'',
'bottom':''
})
- layer.originX = layer.startX = this.offsetLeft
- layer.originY = layer.startY = this.offsetTop
+ layer.originX = layer.startX = position.left
+ layer.originY = layer.startY = position.top
}
layer.startX -= layer.inversionFactor * Math.floor(layer.xRange/2)
Something went wrong with that request. Please try again.