1
尋找一些簡單的乾淨的代碼來寫。當我啓動模式時,我想讓幻燈片暫停。我在按鈕類和類中有模態觸發器。我試過這樣的事情,我知道是錯的,有什麼想法?謝謝。模式啓動暫停傳送帶(引導)
<script type="text/javascript">
$('.modal').on('shown.bs.modal', function (e) {
$('.carousel').pause('slide.bs.carousel');
})
</script>
旋轉木馬代碼
<div class="row">
<div class="carousel-container">
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!--Indicators-->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
<li data-target="#carousel-example-generic" data-slide-to="3"></li>
<li data-target="#carousel-example-generic" data-slide-to="4"></li>
<li data-target="#carousel-example-generic" data-slide-to="5"></li>
</ol>
<!--Wrapper for Slides-->
<div class="carousel-inner">
<div class="item active" id="slide_1"></div>
<div class="item" id="slide_2"></div>
<div class="item" id="slide_3"></div>
<div class="item" id="slide_4"></div>
<div class="item" id="slide_5"></div>
<div class="item" id="slide_6"></div>
</div>
</div>
</div>
</div>
你嘗試'.pause( )'? – Skwal
剛剛嘗試過,它仍然運行。 – gwar9
您使用的是什麼樣的傳送帶/幻燈片?你有沒有嘗試過在這個函數中使用'console.log()'或'alert()'來查看它是否被實際觸發? – Skwal