Home  >  Q&A  >  body text

javascript - How to prevent the page from jumping when the page scroll bar appears

How to prevent the page from jumping when the page scroll bar appears

premise:

1. Need to be compatible with ie8
2. The height of the page depends on the content (that is, whether it is a fixed height)

Question:
Modern browser scroll bars default to the overflow:auto type, but now you need to define an element to the right
(.tips{

position: fixed;
right: 0;
top: 100px;
z-index: 10;    
height: 250px;
width: 300px;

}), when the content height is enough, the page will flicker, tips The right side of the element will be hidden by a width (the width of the scroll bar). Is there any way to solve this?

迷茫迷茫2694 days ago878

reply all(1)I'll reply

  • 三叔

    三叔2017-06-26 10:56:16

    overflow: visible;

    Because users have different screen widths, if you can’t accept flickering, just add a style to make the scroll bar always display

    reply
    0
  • Cancelreply