-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Disable Gallery Looping #342
Comments
Haven't tested this, but based off the documentation, something like this should work: var magnificPopup = $.magnificPopup.instance;
$.magnificPopup.instance.next = function() {
var i = magnificPopup.index;
var num = magnificPopup.items;
if(num > i){
$.magnificPopup.proto.next.call(this /*, optional arguments */);
}
else{
magnificPopup.close();
}
}; |
Tested. It closes the popup on any navigation at all, so I guess it views each popup in the gallery as the only item in the gallery ... ? |
Hmm. That wasn't the behavior I expected. I'll have to throw a sample together and see what I can come up with. In the meanwhile, you might consider posting something to StackOverflow. |
You may just override prev/next functions.
|
Thanks, Dmitry. That's perfect! Much appreciated. Thank you for your attention on this as well, Tieson. |
What would be the correct way to hide the next arrow using your example above, Dmitry? |
I've gotten this far:
Unfortunately, hiding the arrow in this way hides it all on slides, not just this one. For example, if I go back to the previous image, then the "Next" arrow has vanished entirely. |
This works, but seems overly convoluted. In CSS:
And then:
Clearly, having to repeat the functions in two callbacks is less than optimal, but I can't find a callback that encompasses both open and change. Is there such a thing? Or is there any way of going about this that just makes better sense than this hamfisted manipulation of container classes? |
Thanks for posting all of this helpful code everyone. I would add this as a feature request. I seem to remember colorbox has a simple |
Echoing @squarecandy, a config option to enable/disable gallery looping would be a wonderful addition to the library! |
@katherine-boost I'm thinking that with the last official release in 2016 and almost 3000 forks out there, we might be on our own at this point... |
So it seems! 😢 |
I would like prevent galleries from looping the last image back to the first. Instead, I'd like the gallery to close after the last image.
Is there a way to do this? I found nothing about looping enable/disable in the documentation.
Thanks,
Matt
The text was updated successfully, but these errors were encountered: