Scroll Bar Appears and Makes Page Jump

2019-06-08 06:24发布

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

5条回答
冷血范
2楼-- · 2019-06-08 06:41

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

查看更多
Deceive 欺骗
3楼-- · 2019-06-08 06:44

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楼-- · 2019-06-08 06:49

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

body {
  overflow: scroll;
}
查看更多
Viruses.
5楼-- · 2019-06-08 06:55

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.

查看更多
戒情不戒烟
6楼-- · 2019-06-08 07:01
html {
  overflow: -moz-scrollbars-vertical; 
  overflow-y: scroll;
}

See: Making the main scrollbar always visible.

查看更多
登录 后发表回答