Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #986778

    Hi,
    I’m very happy with your horizontal gallery, but is there any way, I can get the images to autoslide?

    I know, I can use a slider for this, but I cannot figure out how to make the slider look like the horizontal gallery, which is the look, I prefer for this site.

    Thank you for your help!

    #986834

    Hey Malene,

    Thank you for using Enfold.

    You can use this script in the functions.php file to set an autorotation to the horizontal gallery element. Set the interval in ms. Default is 2 seconds.

    function ava_horizontal_gallery_interval() {
    	?>
    	<script>
    		(function($) {
    			// set the autorotation duration in ms
    			var interval = 2000;
    
    			$('.av-horizontal-gallery').each(function() {
    				var i = 0;
    				var b = 0;
    				var slider = $(this).find('.av-horizontal-gallery-slider');
    				var item = slider.find('.av-horizontal-gallery-wrap');
    				var next = $(this).find('.next-slide');
    				var prev = $(this).find('.prev-slide');
    				var count = item.length;
    				
    				var nextSlide = () => {
    						setInterval( $.proxy(function() {	
    						next.trigger('click');
    						i++;
    						if(i == count && item.last().is('.av-active-gal-item')) {
    							clearInterval(nextSlide);
    							$(this).trigger('av-reset-item');
    							i = 0;
    						}
    					}, this), interval);
    				}
    
    				nextSlide();
    				
    				$(this).on('av-reset-item', function() {
    					setTimeout( function() {
    						var resetSlide = setInterval( $.proxy(function() {	
    							prev.trigger('click');	
    							if(count == b && item.first().is('.av-active-gal-item')) {
    								clearInterval(resetSlide);
    								b = 0;
    								$(this).trigger('av-next-item');
    							}
    							b++;
    						}, this), 10);
    					}, interval);
    				});
    
    				$(this).on('av-next-item', function() {	
    					nextSlide();
    				});
    			});
    		})(jQuery);
    	</script>
    	<?php
    }
    add_action( 'wp_footer', 'ava_horizontal_gallery_interval', 9999 );

    Best regards,
    Ismael

    #986973

    Just what I needed!

    Thank you – you’re the best!
    /M

    #987266

    Hi,

    Great, glad we could help :-)

    Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #987377

    Hi again:

    One more question: Is it possible to show the caption and/or image title on the images in the slider? For now, I can only see them, if i click on one of the images and I’d like it to show on alle the pictures all of the time (like in a regular slider)..

    Best
    M.

    #988587

    Hi,

    That is possible but it requires you to modify the core theme files. You have to edit it on every update. Please use the theme’s slider instead.

    Best regards,
    Ismael

    #1309223

    Thanks, Ismael
    What do we need to add to this code to make it Page-Specific rather than be across the complete website?

    #1309225

    When I click Update File in functions.php I get “nonce_failure”

    #1309226

    Fixed itself don’t know why???
    Working and saving OK :)
    Thanks for your help

    #1309618

    Hi,
    Glad Ismael could help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold
    Best regards,
    Mike

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Can the horizontal gallery autoslide the images?’ is closed to new replies.