【发布时间】:2019-12-28 17:21:31
【问题描述】:
我有一个大的垂直滚动元素,在其中,我有一个较小的水平滚动元素。 (见sn-p)
body {
height: 100vh;
overflow: hidden;
}
.large {
height: 100%;
font-size: 32px;
overflow-y: scroll;
}
.tall {
height: 120%;
}
.small {
width: 100%;
overflow-x: scroll;
white-space: no-wrap;
}
.wide {
width: 120%;
}
<body>
<div class="large">
This is large content vertical content
<br><hr><br>
<div class="small">
<div class="wide">This is smaller horizontal content</div>
</div>
<div class="tall"></div>
</div>
</body>
当你悬停它时,大的垂直垂直滚动很好,但我希望你悬停水平内容时它会自动滚动,所以用户不必手动拖动滚动条来滚动。有什么方法可以用 HTML、CSS 或 JavaScript 做到这一点?
编辑
如果可能的话,我希望水平滚动由滚轮控制,而不是以一致的速度。
【问题讨论】:
标签: javascript html css