Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjusting rounding in getElementPosition #247

Closed
thenewguy opened this issue Sep 2, 2015 · 5 comments
Closed

adjusting rounding in getElementPosition #247

thenewguy opened this issue Sep 2, 2015 · 5 comments
Labels

Comments

@thenewguy
Copy link
Contributor

Moved from #243 (comment)

I am observing an odd issue that I couldn't reproduce it at first... if you open the page at 100% zoom it works as expected. If you change the zoom to 110% it alternates between scrolling to y coord of 429px and 430px. This was observed at a window width between 548px and 637px according to the chrome web developer plugin. Is the use of parseInt in getElementPosition important?

Changing it to the following prevents the pixel jumping I am observing:

        function getElementPosition(target){
            var iFramePosition = target.getBoundingClientRect();

            getPagePosition(iframeId);

            return {
                x: Math.floor( Number(iFramePosition.left) + Number(pagePosition.x) ),
                y: Math.floor( Number(iFramePosition.top)  + Number(pagePosition.y) )
            };
        }

The modified getElementPosition function is demonstrated here: http://thenewguy.github.io/iframe-resizer/issues/243/6/host.html

@davidjbradshaw
Copy link
Owner

Do you want to put that in a pull request?

@thenewguy
Copy link
Contributor Author

I am doing that now

thenewguy added a commit to thenewguy/iframe-resizer that referenced this issue Sep 2, 2015
thenewguy added a commit to thenewguy/iframe-resizer that referenced this issue Sep 2, 2015
@thenewguy
Copy link
Contributor Author

Not sure how important identical whitespace is to you... eclipse is being difficult with it today

@davidjbradshaw
Copy link
Owner

Tabs rather than spaces.

davidjbradshaw added a commit that referenced this issue Sep 3, 2015
@davidjbradshaw
Copy link
Owner

Merged into dev and will be released in v3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants