Search code examples
jqueryanimationlightboxlightbox2

Change Lightbox 2 animation speed


Lightbox 2 is a wonderful jQuery extension. It does the job on displaying images well, but the animations are unbelivably slow, literally!

The user gets annoyed very quickly and leaves. I've seen Lightbox alternatives even slower, folding out the popup progressively. I can't figure out who would want such a thing.

Question

How can I change the speed of the animations of Lightbox 2, preferably without alternating the original code, i.e. using properties?


Solution

  • You can speed up the fade using fadeDuration and resize speed using resizeDuration but this will mean editing them in the original script.

    Unfortunately as the script is self instantiating so the only way to change the options is to change the script itself

    Example of a faster fade in and resize

    A good alternative to lightbox is FancyBox 2 which allows you to instantiate it yourself and target particular links allowing for more control over the animations for each set of links

    Here is a link to it's api