Okay
  Public Ticket #1361744
Frontpage slider
Closed

Comments

  • qwertyit started the conversation

    Hello,

    Is it possible to make the frontpage sliders random?

    Thank you.

    Regards
    Torben

  •  1,710
    Barry replied

    Hi Torben,

    Unfortunately it is not possible to display the slides in a random order. That requires some code customization within the template file.

    I can provide you a code snippet that will display a different slide on each page load, but the order of all slides will be the same. If you want to use that please copy paste the following in to Appearance > Customize > Theme Options > Custom > Custom JS Head

    <script>
    var currentSlide;
    var rand;
    jQuery(document).ready(function() {
      currentSlide = Math.floor((Math.random() * jQuery('.item').length));
      rand = currentSlide;
      jQuery('#jumbotron-fullwidth').carousel(currentSlide);
      jQuery('#jumbotron-fullwidth').fadeIn(1000);
      setInterval(function(){ 
        while(rand == currentSlide){
          rand = Math.floor((Math.random() * jQuery('.item').length));
        }
        currentSlide = rand;
        jQuery('#jumbotron-fullwidth').carousel(rand);
      },5000);
    });
    </script>
    

    If you really need the randomized order in slides I recommend to install the Crelly Slider plugin, which is a very easy to use slider with advanced options.

    Let me know if you have any questions.

    Best regards,
    Barry
    QreativeThemes.com  |  WordPress Themes