Tagged: horizontal gallery
-
AuthorPosts
-
December 24, 2019 at 2:26 am #1168844
Hi,
I can’t seem to find where I can set the horizontal gallery to scroll automatically. Am I missing something?
If it is not a setting within the component – do you have some code I can add to make it scroll automatically, and loop?
If not, is there another module that will allow me to have a horizontal gallery (small height), that automatically scrolls and loops?
thank you,
JDecember 24, 2019 at 8:57 pm #1168992Hey jajographics,
The horizontal gallery is not built to be scrolling automatically. You could look at the content slider or look for a plugin that has the functionality you need.
Best regards,
VictoriaMay 20, 2020 at 12:55 pm #1214640just added this code to the function php and it worked
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 );May 21, 2020 at 5:00 am #1214883Hi mnydish,
Thanks for sharing the solution that you have applied :)
Thanks also for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Automatic scrolling for horizontal gallery’ is closed to new replies.