gpt4 book ai didi

javascript - Bootstrap 轮播在点击时向上移动

转载 作者:行者123 更新时间:2023-11-28 00:54:55 24 4
gpt4 key购买 nike

我很困惑为什么我的页面或轮播在我第一次点击时会向上移动?这是我的代码,我是从 Bootstrap 获得的。

#tips #carousel-example {
margin: auto;
width: 900px;
}

#tips {
background-color: #fcb595;
max-height: 100%;
}
<div id="tips">
<div id="carousel-example" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel-example" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example" data-slide-to="1"></li>
<li data-target="#carousel-example" data-slide-to="2"></li>
<li data-target="#carousel-example" data-slide-to="3"></li>
</ol>

<div class="carousel-inner">
<div class="item active">
<a href="#"><img src="images/tips/tip1.jpg" /></a>
</div>
<div class="item">
<a href="#"><img src="images/tips/tip1.jpg" /></a>
</div>
<div class="item">
<a href="#"><img src="images/tips/tip1.jpg" /></a>
</div>
<div class="item">
<a href="#"><img src="images/tips/tip1.jpg" /></a>
</div>
<div class="item">
<a href="#"><img src="images/tips/tip1.jpg" /></a>
</div>
</div>

<a class="left carousel-control" href="#carousel-example" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
</div>

这是一个 gif 来展示我的意思:

enter image description here

最佳答案

尝试将控件中的 href 替换为 data-target :

<a class="left carousel-control" data-target="#carousel-example" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" data-target="#carousel-example" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>

关于javascript - Bootstrap 轮播在点击时向上移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45405261/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com