Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #999900

    Hi I’m looking to randomise testimonials. I looked at this topic (https://kriesi.at/support/topic/randomize-testimonials-slider/) but it seems to be outdated. Thank you for your assistance.

    #1000279

    Hey sparkzilla,

    The code is fine, except it has moved to this file
    /enfold/config-templatebuilder/avia-shortcodes/testimonials/testimonials.js

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #1000318

    Hi, I have tried both the code combinations on the original page and neither work. I have placed the file in a child theme, using the same directory structure. Her’s the entire code of the testimonials.js page. You can see the output at: https://newsblocks.io/news-is-data/

    (function($)
    { 
    	"use strict";
    	
    	// -------------------------------------------------------------------------------------------
    	// testimonial shortcode javascript
    	// -------------------------------------------------------------------------------------------
    
    $.fn.randomize = function(childElem) {
      return this.each(function() {
          var $this = $(this);
          var elems = $this.children(childElem);
    
          elems.sort(function() { return (Math.round(Math.random())-0.5); });  
    
          $this.remove(childElem);  
    
          for(var i=0; i < elems.length; i++)
            $this.append(elems[i]);      
    
      });    
    } (jQuery);	
    
    	
    	$.fn.avia_sc_testimonial = function(options)
    	{
    		return this.each(function()
    		{
    			jQuery(".avia-testimonial-row").randomize(".avia-testimonial");
    			var container = $(this), elements = container.find('.avia-testimonial');
    	
    	
    			//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));
    #1000454

    Hi,

    I see the testimonials appear in the sidebar but I could not make out if it was random or not? Please let us know if the above code worked for you or you need any further assistance.

    Best regards,
    Vinay

    #1000515

    The above code does not work.

    #1001160

    Hi,

    It would be much easier to just use a plugin like https://wordpress.org/plugins/testimonials-widget/ and display the widget in the sidebar.

    Best regards,
    Vinay

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.