joe223 / tiny-swiper

Ingenious JavaScript Carousel powered by wonderful plugins. Lightweight yet extensible. Import plugins as needed, No more, no less.
https://tiny-swiper.js.org
1.29k stars 58 forks source link

Disable buttons not working correctly when slider has only 2 slides #60

Closed frankinedinburgh closed 3 years ago

frankinedinburgh commented 3 years ago

Describe the bug When setting the loop option to false and the slider has no more than 2 slides the previous and next buttons will disable incorrectly. When user navigates to the last slide both navigation buttons are disabled.

The issue occurs in the navigation plugin at the checkNavBtnDisabledClass. By updating the condition in index > minIndex to index >= minIndex and index < minIndex to index <= maxIndex I'm able to see the disable classes working correctly. Is this a known bug that will be fixed in the next release of tiny-swiper ?

Expected behaviour If the slider has 2 or less slides and loop is set to false the nextEl should be disabled when user is at the last slide and the prevEl should not be disabled. When user is at the first slide the prevEl should be disabled and the nextEl should not be disabled

Information

joe223 commented 3 years ago

@frankinedinburgh Hi, would you like to create a fix PR?😁

joe223 commented 3 years ago

Fixed on tiny-swiper@2.0.3, thanks to @frankinedinburgh