Without using the popular scrollTo plugin, how can I scroll to the vertical middle (50%) of the page/div?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
This scrolls the internal scroll of a div to it's vertical middle
JQuery - jump to vert/hori middle of scroll-div
vertical
horizontal
Replace "#scroll-div" with your div. "body" isn't working for me.
jsfiddle
Thats the only solution that works properly for me. Actually its an 2h-try'n'error solution thats do its job pretty well. Maybe someone could explain why scrollTop is never reaching the value of prop("scrollheight") and the written calculation of diff and middle is necessary.