0

I'm using the Revolution Slider plugin for Wordpress. I have 5 images in my slider and I have 30 short texts. I want to show randomly displaying 1 of these 30 texts every time the slider change image. Can you suggest me how can I do (also changing plugin)

Thanks

frankcecca
  • 149
  • 3
  • 13

1 Answers1

0

This can be easily added by a short script and a css rule.

The CSS Part

.forcenoshow { display:none !important} 

The JS Part

jQuery('#yoursliderid').bind('.revolution.slide.onafterswap',function() {
  var randomindex = Math.round(Math.random()*30);
  jQuery('.current-sr-slide-visible').find('.tp-caption').each(function(i) {
      if (i!==randomindex) jQuery(this).addClass("forcenoshow");
});

This will give all layers within the current slide a "display:none !important" attribute to hide the layer. Only 1 layer from the slide will be visible.

More FAQ and Answer at: http://themepunch.com/support-center

ThemePunch
  • 126
  • 5
  • I know it's a tad bit old answer, but where does this script go? is it sill valid after almost 2 years? – Krystian Jan 11 '17 at 22:02