连续的 html 页面滚动

Continuous html page scrolling

本文关键字:滚动 html 连续      更新时间:2023-09-26

我想实现一个连续滚动的html页面。

我发现了一个div示例的连续滚动,但我无法修改代码,使其适用于整个 html 页面:

这是我的代码的jsfiddle:http://jsfiddle.net/howderek/N9PWn/

非常感谢任何帮助为我指明正确的方向。

如果将

div 的宽度/高度设置为 100% 的空间怎么办?

更新:

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

js小提琴

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

你需要调整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;
}

你看过无限滚动吗?