【发布时间】:2020-02-12 15:58:28
【问题描述】:
有人知道我怎样才能获得像本网站底部https://brand.twitch.tv/ 那样的轮播效果吗??
我正在使用我在 codepen 中找到的这个示例来构建本节的结构。
但是当尝试使用垂直滚动将其添加到我的站点时,它不是像 twitch 站点中那样连续滚动,它只是另一个滚动内的滚动。用户感觉很奇怪,如果向下滚动太快可能会错过它。
提前致谢!
https://codepen.io/lemmin/pen/xRyXMZ
body {
margin:0;
font-family:Georgia;
}
#container .box {
width:100vw;
height:100vh;
display:inline-block;
position:relative;
}
#container .box > div {
width:100px;
height:100px;
font-size:96px;
color:#FFF;
position:absolute;
top:50%;
left:50%;
margin:-50px 0 0 -50px;
line-height:.7;
font-weight:bold;
}
#container {
overflow-y:scroll;
overflow-x:hidden;
transform: rotate(270deg) translateX(-100%);
transform-origin: top left;
background-color:#999;
position:absolute;
width:100vh;
height:100vw;
}
#container2 {
transform: rotate(90deg) translateY(-100vh);
transform-origin: top left;
white-space:nowrap;
font-size:0;
}
.one {
background-color: #45CCFF;
}
.two {
background-color: #49E83E;
}
.three {
background-color: #EDDE05;
}
.four {
background-color: #E84B30;
}
<div id="container">
<div id="container2">
<div class="box one"><div>1</div></div>
<div class="box two"><div>2</div></div>
<div class="box three"><div>3</div></div>
<div class="box four"><div>Last</div></div>
</div>
</div>
【问题讨论】:
标签: javascript html css