简体   繁体   English

在Bootstrap Carousel中跳过隐藏的幻灯片

[英]Skip hidden slides in Bootstrap Carousel

I was wondering if there was a way to skip through hidden slides using a bootstrap carousel. 我想知道是否有办法使用bootstrap轮播跳过隐藏的幻灯片。 I am able to show and hide the slides using ng-show() however the carousel still goes to the blank slides. 我能够使用ng-show()显示和隐藏幻灯片,但旋转木马仍然会转到空白幻灯片。 Just wondering if i could make a function for prev or next that goes to next slide where ng-show() = true? 只是想知道我是否可以为prev或next做一个功能,进入下一张幻灯片,其中ng-show()= true?

<div class="carousel-inner" role="listbox">
  <div class="item active" ng-show="solution.check">
    <img src="img_chania.jpg" alt="Chania" width="460" height="345">
  </div>

  <div class="item" ng-show="solution.check">
    <img src="img_chania2.jpg" alt="Chania" width="460" height="345">
  </div>

  <!-- Left and right controls -->
  <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

Maybe this can help you: 也许这可以帮助你:

Take a look at bootstrap carousel documentation here 这里查看bootstrap carousel文档

$("selector").on("slide.bs.carousel", function(){
    if($(nextslide).attr("ng-show") == false){
        // go to next element
    }
});

Check this link . 检查此链接

You can take a look at the link and check what is going on when you click on the next or prev buttons. 您可以查看链接并查看单击下一个或上一个按钮时发生的情况。 The link is a source to w3schools where you can "try it". 该链接是w3schools的源,您可以“尝试”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM