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

Improve menu placement. #1434 #1556

Merged
merged 2 commits into from
Aug 5, 2016
Merged

Improve menu placement. #1434 #1556

merged 2 commits into from
Aug 5, 2016

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Jul 12, 2016

Use getBoundingClientRect() to improve handling of menu placement when the body is scrolled or has margin settings. Resolves issue #1434.

Here bbox.right gives the position of the right-hand side of the body, unless it is scrolled left, in which case the bbox.left will be negative, so we add it in. These don't seem to take the left margin into account, so we add that in as well.

…n the body is scrolled or has margin settings. Resolves issue mathjax#1434.
@pkra pkra added this to the MathJax v2.7.0 milestone Jul 12, 2016
@@ -313,6 +313,9 @@
this.posted = true;
if (menu.offsetWidth) menu.style.width = (menu.offsetWidth+2) + "px";
var x = event.pageX, y = event.pageY;
var bbox = document.body.getBoundingClientRect();
var styles = (window.getComputedStyle ? window.getComputedStyle(document.body) : {marginLeft: "0px"});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove obsolete parens.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zorkow
Copy link
Member

zorkow commented Aug 4, 2016

lgtm

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

Successfully merging this pull request may close these issues.

3 participants