Scroll Bar Appears and Makes Page Jump

馋奶兔 提交于 2019-12-23 03:48:07

问题


I have aJQuery animation that expands a DIV and makes it go larger than the browser. When that happens a scroll bar appears and meks the page look as if it jumps. Anyone have any solutions for this?

http://www.kerrydean.ca/MATHESON/home5.html


回答1:


html {
  overflow: -moz-scrollbars-vertical; 
  overflow-y: scroll;
}

See: Making the main scrollbar always visible.




回答2:


If you know you will need need the overflow then turn it on in CSS

body {
  overflow: scroll;
}



回答3:


I guessing that the page looks like it 'jumps' because the vertical scroll bar is dynamically added to the window when the content goes below the bottom of the browser.

You can make the vertical scroll bar always appear regardless whether or not there is content by setting the height of your HTML tag to 101%:

<html xmlns="http://www.w3.org/1999/xhtml" style="height: 101%;">



回答4:


If the page is never supposed to scroll, you can set overflow: hidden on the body tag. Also, you might set make the gutters on the left side constant width.




回答5:


You can do "overflow-y:hidden" on the body element and it will disable scrollbar



来源:https://stackoverflow.com/questions/5834196/scroll-bar-appears-and-makes-page-jump

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!