Hello,
I’d like the horizontal slider to either go back to the first slide after it has reached the last slide, or remove the right arrow when it reaches the last slide to indicate you can only go back, as well as remove the left arrow when you reach the very first slide. Is this doable?
Hey bobfurgo,
Thank you for your patience and the link to your site, try adding this script to the end of your functions.php file in Appearance ▸ Editor, it is for the horizontal gallery and counts the slides and adds a class to first and last ones, then hides the next and previous buttons on the first and last slide.
function horizontal_gallery_remove_first_last_slideshow_arrows() { ?>
<script>
(function($){
$(window).load(function(){
var lis = $('.av-horizontal-gallery-slider .av-horizontal-gallery-wrap').length;
var hgs = $('.av-horizontal-gallery-slider .av-horizontal-gallery-wrap');
var prev = $('.av-horizontal-gallery .av-horizontal-gallery-prev');
var next = $('.av-horizontal-gallery .av-horizontal-gallery-next');
$('.av-horizontal-gallery-slider .av-horizontal-gallery-wrap').each(function(index){
if(index<1)$(this).addClass('first');
if(index>=lis-1)$(this).addClass('last');
})
$('.avia-slideshow-arrows a').click(function(){
if (hgs.is('.first.av-active-gal-item')){
prev.css({'display' : 'none'});
}else{
prev.css({'display' : 'block'});
}
if (hgs.is('.last.av-active-gal-item')){
next.css({'display' : 'none'});
}else{
next.css({'display' : 'block'});
}
});
});
})(jQuery);
</script>
<?php
}
add_action('wp_footer', 'horizontal_gallery_remove_first_last_slideshow_arrows');
If you have any issues with it please check that you are not forcing the jQuery to load in the footer in the theme option Enfold Theme Options ▸ Performance ▸ Load jQuery in your footer or with your caching plugin.
Best regards,
Mike
It worked! Thank you so much Mike, I really appreciate it :)
Hi,
Glad we were able to 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