Bug if double clik
  • hi !

    if you double click in a picture, prettyPhoto bugs.
  • This is a pretty big... and annoying but... does anyone have a fix for it?
  • If I'm experiencing the same bug, it looks like the problem is due to a race condition between the fades/animations between prettyPhoto.open() and prettyPhoto.close(). Basically, if you click a link/image to open it, but double click again really fast, it will fire open, then _showContent, but the double click will fire the close function on the overlay before _showContent gets called, causing the overlay to disappear and the #pp_full_res div to be emptied.

    Short of setting up a cancelable queue for open/close events and/or their animations, I added a _blockClose variable that is set to true when open is called and set back to false when open is done running. The close function returns immediately if this value is true, preventing this weirdness on double click.

    Kinda hard to explain well, but I hope that all makes sense and helps someone out.
  • I ran into this double-click bug about two hours before bryanblakey posted the fix above -- what great timing! Whether this is the "right" solution or not, I hope some patch for the race condition gets rolled into the official release. It's a big improvement. In case anyone else needs more of a clues, here's how I fixed it:

    1) I stuck _blockClose = true; at the very start of the $.prettyPhoto.open() definition
    2) Then I put _blockClose = false; just before settings.changepicturecallback(); at the end of _showContent()
    3) Finally I put "if (_blockClose) { return false; }" at the very start of $.prettyPhoto.close()

    Maybe there are better places to work this in? Anyhow, it solved the double-click for me, for now...

    Thanks again, bryanblakey, very helpful.
  • this solution doesnt work for me i dont know why. Have PrettyPhoto 3.0 beta. and IE works ok but in FF Bug still exist. Plx Help.
  • Thanks for the locking solution bryanblakey and adamnorwood, it worked great! I'd like for these kinds of changes to be incorporated into the main source.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!