malsup / cycle2

2nd gen cycling
899 stars 239 forks source link

Next Previous Issue when only one slide offscreen #843

Open robdew69 opened 4 years ago

robdew69 commented 4 years ago

I am running into an issue with the previous control on the carousel on https://www.liberty.edu/lp/betterworld/david-hess/. There are 7 slides and on my desktop monitor, 6 are visible. On page load, the next button works and slides the images to the left, showing the one image that was offscreen.

However, even though the previous button is enabled, it does not slide back.

If I resize the screen smaller or add more images, it works. It seems to only be an issue when ALL but one slide is visible.

Below is the JS we are including:

$('.fade-slider .slider, .slider.fade-slider').each(function() { var cycle = $(this), controls = cycle.find('.controls'), fx = cycle.data('fx') || 'fade', speed = cycle.data('speed') || 200; cycle.cycle({ log: false, speed: speed, fx: fx, swipe: true, slides: "> div", next: controls.find('.cycle-next'), prev: controls.find('.cycle-prev'), carouselVisible: 1, }); });