Tagged: randomize, slider, testimonial
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
May 27, 2022 at 2:21 pm #1353158
Hi crew,
Looking to randomize testimonials on my install. See that there is a thread from 2015, but the code doesn’t work with the new version. Would someone be able to help provided updated js?
https://kriesi.at/support/topic/randomize-testimonials-slider/
Thanks!
May 27, 2022 at 3:01 pm #1353164Hey Scout-Bri,
Thanks for the link to the old thread, the testimonials script is now in it’s own file at:
\wp-content\themes\enfold\config-templatebuilder\avia-shortcodes\testimonials\testimonials.js
try saving your current file to your desktop for fallback and create a new file with this code:(function($) { "use strict"; // ------------------------------------------------------------------------------------------- // testimonial shortcode javascript // ------------------------------------------------------------------------------------------- $.fn.shuffle = function() { var allElems = this.get(), getRandom = function(max) { return Math.floor(Math.random() * max); }, shuffled = $.map(allElems, function(){ var random = getRandom(allElems.length), randEl = $(allElems[random]).clone(true)[0]; allElems.splice(random, 1); return randEl; }); this.each(function(i){ $(this).replaceWith($(shuffled[i])); }); return $(shuffled); }; $.fn.avia_sc_testimonial = function(options) { return this.each(function() { var container = $(this), elements = container.find('.avia-testimonial'); $('.avia-testimonial').shuffle(); //trigger displaying of thumbnails container.on('avia_start_animation', function() { elements.each( function(i) { var element = $(this); setTimeout( function(){ element.addClass('avia_start_animation'); }, (i * 150) ); }); }); }); }; }(jQuery));
Then clear your browser cache and any cache plugin, and check.
Note that clearing javascript cache may require a few tries.Best regards,
Mike -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.