modal scrolls to top (I explain why)
-
I see you’ve gotten a couple bug reports about the modal scrolling the page to the top. Here’s what’s causing it:
.md-perspective, .md-perspective body { height: 100%; overflow: hidden; }
When applied to the html element like so:
classie.add( document.documentElement, 'md-perspective' );
The browser (chrome in my case) scrolls to the top because you’ve set the height of the content to the same as the height of window. So only the top of the page technically exists, so the scroll bar is hidden and the top of the content (the only part that exists) is shown.
I’ve experimented in the past a bit with trying to get rid of the scrollbar on modals. In general I advise against doing this at all, since it tends to cause problems, but if you must mess with the scrollbar, then please save the scrollbar position when opening your modal, and put it back when you’re done. This is surprisingly easy to do in javascript.
- The topic ‘modal scrolls to top (I explain why)’ is closed to new replies.