Okay
  Public Ticket #1506029
Slider
Closed

Comments

  •  1
    Jason started the conversation

    I use the slider on my homepage just as it is in the demo.  I I found the "sliding" to be too much activity, so I disabled automatic sliding.  However I created 3 slides all with catchy descriptions and calls to action.  Is there a way that the slider can be called to load a random slide per page visit or page refresh?

    Thanks for the theme!

    Jason

  •  1,710
    Barry replied

    Hi Jason,

    Unfortunately it is not possible to display the slides in a random order, this required custom coding inside the template files.

    But with the code below the slider will display a different slide on each page load, but the order of the slides does not change. You can add the code via 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>


    Best regards,
    Barry
    QreativeThemes.com  |  WordPress Themes

  •  1
    Jason replied

    This is a nice workaround, and will likely work better for what I need.  Thank you.

  •  1,710
    Barry replied

    Great! You're welcome.

    If you have any questions feel free to ask.

    Best regards,
    Barry
    QreativeThemes.com  |  WordPress Themes