ashleydw / lightbox

A lightbox gallery plugin for Bootstrap
http://ashleydw.github.io/lightbox
MIT License
1.85k stars 1.3k forks source link

navigateTo in version 5 with Bootstrap 4? #271

Closed ozzy-simpson closed 6 years ago

ozzy-simpson commented 6 years ago

navigateTo, which I was able to use in version 4, now doesn't work in version 5 for Bootstrap 4. Can this be added back/fixed?

ashleydw commented 6 years ago

navigateTo still exists, what does work about it? It's a core call in navigateLeft/Right so it should work

ozzy-simpson commented 6 years ago

If I do something like the below, nothing happens when #flag is clicked

  $(document).on('click', '[data-toggle="lightbox"]', function(event) {
        event.preventDefault();
        $(this).ekkoLightbox({
            onShown: function() {
                var lb = this;
                $(lb.modal_content).on('click', '#flag', function(e) {
                    e.preventDefault();
                    lb.navigateTo(2);
                });
            }
        });
    });
ozzy-simpson commented 6 years ago

I figured out the problem. Instead of $(lb.modal_content).on('click', '#flag', function(e) { ... }); it needed to be $(document).on('click', '#flag', function(e) { ... });