- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试构建一个带有 slider 的时间轴,您可以在其中隐藏更多元素,单击按钮时,它会滑动并显示隐藏的元素。问题是当我添加更多元素时,它会收缩其他元素以适应 div,但我需要它来隐藏通过 div 边缘的元素,并且我可以通过水平滚动条或单击按钮来显示它们。
谁能帮帮我??
这是我到目前为止的代码,如果您想查看问题,只需将更多元素添加到列表中即可。
https://codepen.io/Arthur_Oliveira/pen/GRKNGBb
.timeline-background {
position: relative;
width: 100%;
height: 300px;
background-color: #F5F5F5;
padding: 0;
padding-top: 50px;
}
.list-items {
position: absolute;
width: auto;
height: auto;
margin: 0;
padding: 0;
margin-top: 20px;
max-width: 400px;
overflow: hidden;
object-fit: cover;
}
.list-item {
position: absolute;
width: 500px;
top: 0;
height: auto;
margin: 0;
padding: 0;
}
.list-items li {
position: relative;
display: flex;
}
.list-item li:first-child {
position: absolute;
left: 78px;
top: 63px;
cursor: pointer;
list-style: none;
width: 30px;
height: 30px;
background-color: #fff;
border: 3px solid #AD80FF;
color: #D9D9D9;
border-radius: 50%;
float: left;
}
.list-item li:last-child {
position: absolute;
right: -13px;
top: 63px;
cursor: pointer;
list-style: none;
width: 30px;
height: 30px;
margin-left: 50px;
background-color: #fff;
border: 3px solid #AD80FF;
color: #D9D9D9;
border-radius: 50%;
float: left;
}
.list-item li:last-child:hover {
color: #FF04FF;
}
.list-item li:first-child:hover {
color: #FF04FF;
}
.list-item .active {
}
.list-items li {
cursor: pointer;
margin-left: 50px;
list-style: none;
width: 15px;
height: 15px;
background-color: #fff;
border: 3px solid #D9D9D9;
margin-top: 0;
border-radius: 50%;
float: left;
}
.list-items li.active {
cursor: pointer;
margin-left: 50px;
list-style: none;
border: 3px solid #FF04FF;
background-color: #FF04FF;
border-radius: 50%;
float: left;
}
.list-item li:first-child:after {
cursor: initial;
position: absolute;
content: '';
width: 50px;
margin-top: -6px;
margin-left: 40px;
height: 50%;
border-bottom: 2px solid #D9D9D9;
z-index: 0;
}
.list-items li:after {
cursor: initial;
position: absolute;
content: '';
width: 50px;
margin-top: 0px;
margin-left: 15px;
height: 50%;
border-bottom: 2px solid #D9D9D9;
z-index: 0;
}
.list-item ul .actived:after {
border-bottom: 2px solid #FF04FF;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="d-flex justify-content-center timeline-background">
<div class="d-flex justify-content-center">
<div class="list-items">
<ul class="d-flex d-xl-flex justify-content-center align-items-center justify-content-xl-center">
<li class="active"><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
</ul>
</div>
<div class="list-item">
<ul>
<li class="d-flex d-sm-flex d-md-flex d-lg-flex d-xl-flex justify-content-center align-items-center justify-content-sm-center align-items-sm-center justify-content-md-center align-items-md-center actived" href="#list1"><i class="icon ion-ios-arrow-back"></i></li>
<li class="d-flex justify-content-center align-items-center"><a class="item" href="#"></a><i class="icon ion-ios-arrow-forward"></i></li>
</ul>
</div>
</div>
</div>
更新::我将类列表项更改为:
.timeline-background {
position: relative;
width: 100%;
height: 300px;
background-color: #F5F5F5;
padding: 0;
padding-top: 50px;
}
.list-items {
position: relative;
width: auto;
height: auto;
margin: 0;
padding: 0;
margin-top: 20px;
margin-left: 86px;
max-width: 440px;
}
.list-item {
position: absolute;
width: 500px;
top: 0;
height: auto;
margin: 0;
padding: 0;
}
.list-items li {
position: relative;
display: flex;
}
.list-item li:first-child {
position: absolute;
left: 78px;
top: 63px;
cursor: pointer;
list-style: none;
width: 30px;
height: 30px;
background-color: #fff;
border: 3px solid #AD80FF;
color: #D9D9D9;
border-radius: 50%;
float: left;
}
.list-item li:last-child {
position: absolute;
right: -13px;
top: 63px;
cursor: pointer;
list-style: none;
width: 30px;
height: 30px;
margin-left: 50px;
background-color: #fff;
border: 3px solid #AD80FF;
color: #D9D9D9;
border-radius: 50%;
float: left;
}
.list-item li:last-child:hover {
color: #FF04FF;
}
.list-item li:first-child:hover {
color: #FF04FF;
}
.list-item .active {
}
.list-items li {
cursor: pointer;
margin-left: 50px;
list-style: none;
width: 15px;
height: 15px;
background-color: #fff;
border: 3px solid #D9D9D9;
margin-top: 0;
border-radius: 50%;
float: left;
}
.list-items li.active {
cursor: pointer;
margin-left: 50px;
list-style: none;
border: 3px solid #FF04FF;
background-color: #FF04FF;
border-radius: 50%;
float: left;
}
.list-item li:first-child:after {
cursor: initial;
position: absolute;
content: '';
width: 50px;
margin-top: -6px;
margin-left: 40px;
height: 50%;
border-bottom: 2px solid #D9D9D9;
z-index: 0;
}
.list-items li:after {
cursor: initial;
position: absolute;
content: '';
width: 50px;
margin-top: 0px;
margin-left: 15px;
height: 50%;
border-bottom: 2px solid #D9D9D9;
z-index: 0;
}
.list-item ul .actived:after {
border-bottom: 2px solid #FF04FF;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="d-flex justify-content-center timeline-background">
<div class="d-flex justify-content-center">
<section class="list-items">
<ul class="dots">
<li class="active"><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
</ul>
</section>
<div class="list-item">
<ul>
<li class="d-flex d-sm-flex d-md-flex d-lg-flex d-xl-flex justify-content-center align-items-center justify-content-sm-center align-items-sm-center justify-content-md-center align-items-md-center actived" href="#list1"><i class="icon ion-ios-arrow-back"></i></li>
<li class="d-flex justify-content-center align-items-center"><a class="item" href="#"></a><i class="icon ion-ios-arrow-forward"></i></li>
</ul>
</div>
</div>
</div>
现在它在到达 div 边缘时断开线!
最佳答案
非常感谢那些试图提供帮助的人,我真的很感激!我在这里发布我是如何解决这个问题的!从问题文本中,您可以将我卡住的代码与此处的最终代码进行比较。我所做的是添加 backpage
类,并为其设置宽度并 overflow hidden 和绝对位置,然后将 list-items
类位置更改为绝对位置并设置一个固定的宽度,而不是我只是调整元素在屏幕上的位置!!
这里是最终代码:
.timeline-background {
position: relative;
width: 100%;
height: 300px;
background-color: #F5F5F5;
padding: 0;
padding-top: 50px;
}
.backpage {
position: relative;
overflow: auto;
width: 450px;
}
.list-items {
position: absolute;
width: 2000px;
height: auto;
margin: 0;
padding: 0;
margin-top: 20px;
margin-left: -10px;
}
.list-item {
position: absolute;
width: 500px;
top: 0;
height: auto;
margin: 0;
padding: 0;
}
.list-items li {
position: relative;
}
.list-item li:first-child {
position: absolute;
left: 20px;
top: 63px;
cursor: pointer;
list-style: none;
width: 30px;
height: 30px;
background-color: #fff;
border: 3px solid #AD80FF;
color: #D9D9D9;
border-radius: 50%;
float: left;
}
.list-item li:last-child {
position: absolute;
right: -13px;
top: 63px;
cursor: pointer;
list-style: none;
width: 30px;
height: 30px;
margin-left: 50px;
background-color: #fff;
border: 3px solid #AD80FF;
color: #D9D9D9;
border-radius: 50%;
float: left;
}
.list-item li:last-child:hover {
color: #FF04FF;
}
.list-item li:first-child:hover {
color: #FF04FF;
}
.list-item .active {
}
.list-items li {
cursor: pointer;
margin-left: 50px;
list-style: none;
width: 15px;
height: 15px;
background-color: #fff;
border: 3px solid #D9D9D9;
margin-top: 0;
border-radius: 50%;
float: left;
}
.list-items li.active {
cursor: pointer;
margin-left: 50px;
list-style: none;
border: 3px solid #FF04FF;
background-color: #FF04FF;
border-radius: 50%;
float: left;
}
.list-items li:not(:last-child):after {
cursor: initial;
position: absolute;
content: '';
width: 50px;
margin-top: 0px;
margin-left: 12px;
height: 50%;
border-bottom: 2px solid #D9D9D9;
z-index: 0;
}
.list-items li:first-child:before {
cursor: initial;
position: absolute;
content: '';
width: 50px;
margin-top: 0px;
margin-left: -53px;
height: 50%;
border-bottom: 2px solid #D9D9D9;
z-index: 0;
}
.list-items li:last-child:after {
cursor: initial;
position: absolute;
content: '';
width: 50px;
margin-top: 0px;
margin-left: 12px;
height: 50%;
border-bottom: 2px dashed #D9D9D9;
z-index: 0;
}
.list-item ul .actived:after {
border-bottom: 2px solid #FF04FF;
}
.list-item ul .actived {
color: #FF04FF;
}
.dots {
width: 100%;
position: relative;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="d-flex d-xl-flex justify-content-center justify-content-xl-center timeline-background">
<div class="backpage">
<section class="list-items">
<ul class="dots">
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
<li><a class="item" href="#"></a></li>
</ul>
</section>
</div>
<div class="list-item">
<ul>
<li class="d-flex d-sm-flex d-md-flex d-lg-flex d-xl-flex justify-content-center align-items-center justify-content-sm-center align-items-sm-center justify-content-md-center align-items-md-center" href="#list1"><i class="icon ion-ios-arrow-back"></i></li>
<li class="d-flex justify-content-center align-items-center"><a class="item" href="#"></a><i class="icon ion-ios-arrow-forward"></i></li>
</ul>
</div>
</div>
再次,非常感谢!!
关于html - 添加元素时时间轴 slider 被压缩,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57597504/
我创建了一个用户可以添加测试的字段。这一切运行顺利我只希望当用户点击(添加另一个测试)然后上一个(添加另一个测试)删除并且这个显示在新字段中。 所有运行良好的唯一问题是点击(添加另一个字段)之前添加另
String[] option = {"Adlawan", "Angeles", "Arreza", "Benenoso", "Bermas", "Brebant
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我正在努力将 jQuery 滚动功能添加到 nav-tab (Bootstrap 3)。我希望用户能够选择他们想要的选项卡,并在选项卡内容中有一个可以平滑滚动到 anchor 的链接。这是我的代码,可
我正在尝试在用户登录后再添加 2 个 ui 选项卡。首先,我尝试做一个之后。 $('#slideshow').tabs('remove', '4'); $("#slideshow ul li:last
我有一个包含选择元素的表单,我想通过选择添加和删除其中一些元素。这是html代码(这里也有jsfiddle http://jsfiddle.net/txhajy2w/):
正在写这个: view.backgroundColor = UIColor.white.withAlphaComponent(0.9) 等同于: view.backgroundColor = UICo
好的,如果其中有任何信息,我想将这些列添加到一起。所以说我有 账户 1 2 3 . 有 4 个帐户空间,但只有 3 个帐户。我如何创建 java 脚本来添加它。 最佳答案 Live Example H
我想知道是否有一种有效的预制算法来确定一组数字的和/差是否可以等于不同的数字。示例: 5、8、10、2,使用 + 或 - 等于 9。5 - 8 = -3 + 10 = 7 + 2 = 9 如果有一个预
我似乎有一个卡住的 git repo。它卡在所有基本的添加、提交命令上,git push 返回所有内容为最新的。 从其他帖子我已经完成了 git gc 和 git fsck/ 我认为基本的调试步骤是
我的 Oracle SQL 查询如下- Q1- select hca.account_number, hca.attribute3, SUM(rcl.extended_amou
我正在阅读 http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingG
我正在尝试添加一个“加载更多”按钮并限制下面的结果,这样投资组合页面中就不会同时加载 1000 个内容,如下所示:http://typesetdesign.com/portfolio/ 我对 PHP
我遇到这个问题,我添加了 8 个文本框,它工作正常,但是当我添加更多文本框(如 16 个文本框)时,它不会添加最后一个文本框。有人遇到过这个问题吗?提前致谢。 Live Link: JAVASCRIP
add/remove clone first row default not delete 添加/删除克隆第一行默认不删除&并获取正确的SrNo(例如:添加3行并在看到问题后删除SrNo.2)
我编码this ,但删除按钮不起作用。我在控制台中没有任何错误.. var counter = 0; var dataList = document.getElementById('materi
我有一个类似数组的对象: [1:数组[10]、2:数组[2]、3:数组[2]、4:数组[2]、5:数组[3]、6:数组[1]] 我正在尝试删除前两个元素,执行一些操作,然后将它们再次插入到同一位置。
使用的 Delphi 版本:2007 你好, 我有一个 Tecord 数组 TInfo = Record Name : String; Price : Integer; end; var Info
我使用了基本的 gridster 代码,然后我声明了通过按钮添加和删除小部件的函数它工作正常但是当我将调整大小功能添加到上面的代码中时,它都不起作用(我的意思是调整大小,添加和删除小部件) 我的js代
title 323 323 323 title 323 323 323 title 323 323 323 JS $(document).keydown(function(e){
我是一名优秀的程序员,十分优秀!