-
Notifications
You must be signed in to change notification settings - Fork 431
Getting gallery to loop back to beginning on last image #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, |
This would be very handy indeed. So far, it seems only this is missing. |
Maybe just hiding the button(or marking it as disabled) if there's no next image or previous one might make sense until this is implemented. |
That's also an option, but I've always really liked the bounce effects :) |
Agreed, but it can be confusing because one might click on next and nothing will happen :P |
Do you mean when CSS animations are not supported? Because the effect itself is quite self-explaining :P |
Generally, it's bad UI practice, that is all I'm saying. We need to consider the end users like they know nothing :) |
@XhmikosR I always think about the end users and UX. Consider the case when someone quickly click next button, then it suddenly disappears and he closes the whole lightbox by mistake. Another case, someone moves the images using the keyboard, then it stops working, but he doesn't see any visual indication (he may not notice the hidden right button or they may be hidden - e.g. mobile users). Anyway, it shouldn't be discussed in this issue :) @jimcallender why did you close this? It's an approved feature for v.2.0. |
But the visual indication is the button's disabled state. That's the proper
|
What about mobile users then? |
They don't see any button by default, do they? Apart from the close one.
|
That's right, so here's my question, how to handle this case, if you're saying we should put button's state to disabled instead of the bounce effect. |
Well that case remains the same. I'm mostly talking about the case where the button's are visible. That's right, so here's my question, how to handle this case, if you're — |
Okay, now I get it. Let's keep this idea open for future releases :) |
Hey, this loop back functionality is definitely something that would be nice to have, at least as an option, if you ever have the time to make it! Excellent plugin either way. |
@feimosi: this is still valid please open the issue. |
Yes, I agree. This feature is still on the radar, when only I have more time. |
any update on this? Would love to infinitely loop it |
I've planned this feature for the v2.0 release, which should roll out later this year (hopefully). Would it be satisfying to use a programmatic solution by now? Bind to the |
That would work. Do you have a programatic solution for not having the modal as big as the screen? Maybe css stuff? thank you! |
You want to have images of smaller size than 100%? Maybe overriding this CSS would help? |
thanks! web stuff is not my forte :( |
No problem! Give it a try :) |
I would love to have this loop feature, it is the only thing that has been missing for me when using this on various sites. If you have a little custom code I could add into the current version that would be great. Thank you for your work on this, it is one of the best performing lightboxes on a wide variety of devices. |
@mountaineer25 @Discipol I've prepared a working example of what I was talking about in my previous comments about You can use it e.g. like this: Let me know if that works for you. |
@feimosi: can't we add a new option which will just do this? |
Yeah, I just wanted to provide a very quick solution many people asked for. By the way, it could be tested by others before releasing. |
I have tried using this on a couple of pages with no success. The only differences are the class of .gallery and the options for captions and buttons.
|
Just in case, here is how I'm looping the gallery in the both directions: (function() {
var previousImageIndex = -1;
baguetteBox.run('.js-gallery', {
onChange: function(currentImageIndex, imagesCount) {
var firstImageIndex = 0;
var lastImageIndex = imagesCount - 1;
var isFirstImage = currentImageIndex === firstImageIndex;
var isLooping = currentImageIndex === previousImageIndex;
if (isLooping) {
if (isFirstImage) {
baguetteBox.showImage(lastImageIndex);
} else {
baguetteBox.showImage(firstImageIndex);
}
} else {
previousImageIndex = currentImageIndex;
}
},
afterHide: function() {
previousImageIndex = -1;
},
animation: false
});
})(); I used the |
Closed in favor of #167. |
I have cloned |
The following PR implements gallery looping. I'm waiting for feedback before merging it. |
Hi there,
I would like to return the slide back to the first gallery image.
Currently, when you get to the last image, the user gets 'stuck'.
Please provide support on how to fix this?
The text was updated successfully, but these errors were encountered: