HTML5幻灯片无法正常工作(轮播)按钮无法正常工作

问题描述 投票:-1回答:1
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="C:/Users/Acer/Desktop/auto/cars/sliders/slider1.png" alt="BMW" 
style="width:100%;" >
</div>
<div class="item">
<img src="C:/Users/Acer/Desktop/auto/cars/sliders/slider2.png" alt="BMW" 
style="width:130%;" >
</div>
<div class="item">
<img src="C:/Users/Acer/Desktop/auto/cars/sliders/slider3.png" alt="BMW" 
style="width:100%;" >
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>

this is my slideshow not working buttons i need help 按钮下一步,以前没有工作。这是我的代码需要帮助需要我从w3school网站幻灯片使用旋转木马coppied这个代码,我只编辑位于我的桌面的src图像但幻灯片不工作我不知道为什么有人可以向我解释为什么,谢谢你这是我的第一次使用stackoverflow谢谢。

html carousel slideshow
1个回答
0
投票

jQuery会为你完成这项工作:

$('a[data-slide="prev"]').click(function() {
  $('#myCarousel').carousel('prev');
});

$('a[data-slide="next"]').click(function() {
  $('#myCarousel').carousel('next');
});
© www.soinside.com 2019 - 2024. All rights reserved.