开发者

Prevent scrollbar with MarginLeft style change?

I have a big div with lots of items that I have moving to marginLeft='120%' on an event. I used overflow:hidd开发者_JS百科en to keep it from showing a horizontal scrollbar. But the webpage vertical scrollbar length gets bigger when it moves to the right. I want the div to disappear off the screen(I have it HTML5 transitioning when it does that) but not affect the rest of the page. What am I doing wrong?


The content is not actually moving to the right because the container isn't wide enough so the default action is to drop the content to the next line, hence the vertical scroll.

Try adding another div within the wrapping div with a large width, that way the content will have enough room to actually move to the right.

<div id="wrapper">
    <div id="inner">
        <div id="content"></div>
    </div>
</div>

CSS...

#wrapper {
    overflow: hidden;
}
#inner {
    width: 9000px;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜