本文介绍了bootstrap 2轮播随机过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 大家好, 我有这个javaScript代码来处理 Bootstrap v2 速度和文字 < 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(),您可以创建一个骰子。谷歌如何做到这一点。 Hi all,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. 这篇关于bootstrap 2轮播随机过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-13 13:22