简体   繁体   English

连续的html页面滚动

[英]Continuous html page scrolling

I'd like to achieve a continuous scrolling html page. 我想实现连续滚动的html页面。

I've found this continuous scrolling of a div example, but I am unable to modify the code so it works on a whole html page: 我发现了div示例的这种连续滚动,但是我无法修改代码,因此它可以在整个html页面上使用:

Here is a jsfiddle of my code: http://jsfiddle.net/howderek/N9PWn/ 这是我的代码的jsfiddle: http : //jsfiddle.net/howderek/N9PWn/

Any help in pointing me in the right direction is greatly appreciated. 非常感谢您为我指明正确的方向。

What if you set the width/height of the div to 100% of the space? 如果将div的宽度/高度设置为空间的100%,该怎么办?

UPDATE : 更新

#verticalScroller {
    position: absolute;
    width: 52px;
    height: 98%;
    border: 1px solid red;
    overflow: hidden;
}

jsFiddle 的jsfiddle

天真的答案是让页面的任何内容都存在于滚动div中。

you need to adjust the width in your CSS. 您需要调整CSS的宽度。

#verticalScroller {
    position: absolute;
    width:100%;                       //set the width to 100% to take over the space
    height: 180px;
    border: 1px solid red;
    overflow: hidden;
}

#verticalScroller > div{
    position:absolute;
    width:100%;                     //set the width to 100% there also 
    height:50px;
    border: 1px solid blue;
    overflow:hidden;
}

您是否看过无限滚动?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM