Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

I have this javaScript code to handle Bootstrap v2 speed and text
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('slid slide', toggleCaption).trigger('slid');
    </script>


I want to modify this code to display carousel images randomly. Any suggestions?

Thank you!
Posted

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900