bootstrap 2轮播随机过渡 [英] bootstrap 2 carousel random transition
问题描述
大家好, Hi all, 这篇关于bootstrap 2轮播随机过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
我有这个javaScript代码来处理 Bootstrap v2 速度和文字
< pre lang =Javascript>< script type = text / javascript>
var carouselContainer = $(' 。carousel 跨度>);
var slideInterval = 4000 ;
function toggleCaption(){
var caption = carouselContainer。 find(' 。active')。find(' .carousel-caption');
caption.slideToggle();
}
carouselContainer.carousel({
interval:slideInterval,
cycle: true ,
// pause:hover
})。on(' 滑动幻灯片',toggleCaption).trigger(' 滑动'跨度>);
< / script>
我想修改此代码以随机显示轮播图像。有什么建议吗?
谢谢!( ' .carousel');
var slideInterval = 4000 ;
function toggleCaption(){
var caption = carouselContainer。 find(' 。active')。find(' .carousel-caption');
caption.slideToggle();
}
carouselContainer.carousel({
interval:slideInterval,
cycle: true ,
// pause:hover
})。on(' 滑动幻灯片',toggleCaption).trigger(' 滑动'跨度>);
< / script>
我想修改此代码以随机显示轮播图像。有什么建议吗?
谢谢!
我相信你可以定位滑块以显示特定的幻灯片。你可以利用它来获得优势。使用Math.random(),您可以创建一个骰子。谷歌如何做到这一点。
I have this javaScript code to handle Bootstrap v2 speed and text
<script type="text/javascript">
var carouselContainer = $('.carousel');
var slideInterval = 4000;
function toggleCaption() {
var caption = carouselContainer.find('.active').find('.carousel-caption');
caption.slideToggle();
}
carouselContainer.carousel({
interval: slideInterval,
cycle: true,
//pause: "hover"
}).on('slid slide', toggleCaption).trigger('slid');
</script>
I want to modify this code to display carousel images randomly. Any suggestions?
Thank you!('.carousel');
var slideInterval = 4000;
function toggleCaption() {
var caption = carouselContainer.find('.active').find('.carousel-caption');
caption.slideToggle();
}
carouselContainer.carousel({
interval: slideInterval,
cycle: true,
//pause: "hover"
}).on('slid slide', toggleCaption).trigger('slid');
</script>
I want to modify this code to display carousel images randomly. Any suggestions?
Thank you!I believe you can target the slider to show a specific slide. You could use this to you're advantage. With Math.random() you can create a dice. Google on how to do this.