Search code examples
jquerytwitter-bootstrapgalleryblueimp

Blueimp gallery open through jquery


I am trying to open Blueimp gallery through jquery with preferably a specific index.

I tried to just using jquery to click on the correct a link like so:

var children = $('#links').children();
$(children[index]).click();

This opens the gallery but instantly closes it for some strange reason.

I also tried to just do stuff like:

$('#blueimp-gallery').open();
blueimp.Gallery.open();

But yea those obviously don't work, but can't blame a guy for trying.

So i'm a bit out of ideas. The reason why i want to do this is because I have the gallery running with 2 different sets of css. So I want to press a button that will gather the current index (which i can), then close the gallery, change the css settings and then reopen it by clicking on the corresponding link, but as I said before it just opens and closes it instantly.

Any ideas?

I can't seem to find a method to open the gallery, preferably even with an index

Thanks a lot


Solution

  • I found the answer just now on the way to work. The reason that it gets closed is because a previous closing event is still being triggered with a delay due to a transition speed. So I set a timeout of 650 on opening the new one, which is about the same time as the transition speed so the old screen is closed for sure and the new one gets opened without being closed, hurray! :)