0
我正在使用自舉旋轉木馬,在其中顯示圖像,然後標題從幾秒鐘後從右側滑入。 它的工作原理,但第一張幻燈片有一個問題,它顯示第一張幻燈片的標題,當它移動到第二張時,它僅在一秒鐘後隱藏,然後新的標題滑入。bootstrap旋轉木馬字幕動畫僅在第二張幻燈片上激活
這是我的代碼:
<div class="carousel-inner">
<div class="item active">
<img src="test.png" alt="Chicago">
<div class="carousel-caption">
<div class="carousel-caption-inner" data-interval="2000">
<p class="slider-text small"><span class="slider-padding">what makes</span> us <span class="slider-green" id="banner-change">specialists?</span></p>
<p class="slider-text">We just do ip</p>
<p class="slider-text"><span class="slider-green">exceptionally</span></p>
</div>
</div>
</div>
<div class="item">
<img src="test.png" alt="Chicago">
<div class="carousel-caption">
<div class="carousel-caption-inner">
<p class="slider-text small"><span class="slider-padding">what makes</span> us <span class="slider-green">distinctive?</span></p>
<p class="slider-text">Market leading</p>
<p class="slider-text"><span class="slider-green"> brought to life</span> and outside london</p>
</div>
</div>
</div>
<div class="item">
<img src="test.png" alt="Chicago">
<div class="carousel-caption">
<div class="carousel-caption-inner">
<p class="slider-text small"><span class="slider-padding">what makes</span> us <span class="slider-green">stand out?</span></p>
<p class="slider-text">The <span class="slider-green">only way</span> to do great work is to love what you do</p>
</div>
</div>
</div>
<div class="item">
<img src="test.png" alt="Los Angeles">
<div class="carousel-caption">
<div class="carousel-caption-inner">
<p class="slider-text small"><span class="slider-padding">what makes</span> us <span class="slider-green">the right choice?</span></p>
<p class="slider-text">holistic thinking,<span class="slider-green"> made real</span></p>
</div>
</div>
</div>
<div class="item">
<img src="test.png" alt="New York">
<div class="carousel-caption">
<div class="carousel-caption-inner">
<p class="slider-text small"><span class="slider-padding">what makes</span> us <span class="slider-green">effective?</span></p>
<p class="slider-text">Intellectual property</p>
<p class="slider-text">- <span class="slider-green"> brought to life</span></p>
</div>
</div>
</div>
</div>
</div>
和:
<script type="text/javascript">
var carouselContainer = $('.carousel');
var slideInterval = 3000;
$(document).ready(function() {
function toggleCaption() {
$('.carousel-caption').hide();
var caption =
carouselContainer.find('.active').find('.carousel-
caption');
caption.delay(1000).toggle("slide", {direction:'right'});
}
carouselContainer.carousel({
interval: slideInterval,
cycle: true,
pause: "hover"
}).on('slid.bs.carousel', function() {
toggleCaption();
});
});
</script>
任何人都知道我怎麼能解決這個問題?看來這個功能只在第二張幻燈片上激活,而不是第一張。
使用** ** animate.css類動畫 –