Canvas swiper slider - how to stop loop and hide buttons

1 reply · opened Sep 10, 2016

JjohnjohnSep 10, 2016

Am using the canvas swiper slider and added data-loop="true" to have it loop.
Questions

  1. how to hide the navigation buttons when there is only 1 slide
  2. how to stop the loop when there is only 1 slide
SSemicolon WebSTAFFSep 12, 2016

Hello,

This is Definitely Possible. Please find the following Line of Code in the js/functions.js File:

if( $slider.hasClass('customjs') ) { return true; }

and then add the following Code just a Line before the above mentioned code:

if( $slider.find('.swiper-slide').length < 2 ) {
	$slider.addClass('customjs');
	$slider.find('#slider-arrow-left,#slider-arrow-right').hide();
}

Your Code should look something like this:

if( $slider.find('.swiper-slide').length < 2 ) {
	$slider.addClass('customjs');
	$slider.find('#slider-arrow-left,#slider-arrow-right').hide();
}

if( $slider.hasClass('customjs') ) { return true; }

This will definitely work fine. Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard
Canvas swiper slider - how to stop loop and hide buttons · Canvas Template Support