Hi. This issue relate issue #733. Sorry for creating a new issue, but I don't like to comment on closed issue.
I agree with @XavierDupessey :
I agree this behaviour is by design and a custom UI makes it possible to hide first / last arrow. But the user will still be able to loop using his keyboard (if arrowKeys set to true). As this code is part of core.js, I think this feature should be native, don't you?
I don't get why the loop option should only control swipe gesture. The core contains next and prev functions, IMHO theses functions should be impacted by the loop option.
e.g.:
next: function () {
if (_options.loop || _currentItemIndex < _getNumItems() - 1) { // This condition added
self.goTo(_currentItemIndex + 1);
}
},
prev: function () {
if (_options.loop || _currentItemIndex > 0) { // This condition added
self.goTo(_currentItemIndex - 1);
}
},
Don't you?
I agree, it makes sense to me to have loop: false mean loop: false in all scenarios. Either that, or specific options like touchLoop, arrowLoop, keysLoop
I agree with this!
This fix seems to work fine, and I think it should be standardized too, or a new option added to maintain compatibility.
Eagerly waiting for this feature too... please add it, already many years are passed by...
my workaround, maybe it helps:
// disable html-arrows control
gallery.getCurrentIndex() === 0 ? $('.pswp__button--arrow--left').hide() : $('.pswp__button--arrow--left').show();
gallery.getCurrentIndex()+1 === gallery.items.length ? $('.pswp__button--arrow--right').hide() : $('.pswp__button--arrow--right').show();
// disable keys left+right control
$('body').keydown(function(e) {
// key left
if ((e.keyCode || e.which) == 37) {
if (gallery.getCurrentIndex() === 0) {
gallery.options.arrowKeys = false;
} else {
gallery.options.arrowKeys = true;
}
}
// key right
if ((e.keyCode || e.which) == 39) {
if (gallery.getCurrentIndex()+1 === gallery.items.length) {
gallery.options.arrowKeys = false;
} else {
gallery.options.arrowKeys = true;
}
}
});
Most helpful comment
Eagerly waiting for this feature too... please add it, already many years are passed by...