javascriptjquerylightboxlightbox2

Lightbox.options is not a function - lightbox plugin


I am using this lightbox plugin,

http://lokeshdhakar.com/projects/lightbox2/

https://github.com/lokesh/lightbox2/

I have items on the page similar to the example:

<a href="images/image-2.jpg" data-lightbox="my-image">Image #2</a>
<a href="images/image-3.jpg" data-lightbox="my-image">Image #3</a>
<a href="images/image-4.jpg" data-lightbox="my-image">Image #4</a>

it works fine, but I want to change some options, for that according to the documentation http://lokeshdhakar.com/projects/lightbox2/#options it should be

 lightbox.option({
      'resizeDuration': 200,
      'wrapAround': true
    })

however i am getting an error

lightbox.option is not a function

so, how to set the options I need ?

edit: the option snippet I have is AFTER the line where the lightbox js is loaded.

edit2: also the options snippet is inside document ready

edit3: lightbox is loaded and is working fine


Solution

  • As it turned out it has something to do with the version, i was using version 2.7.1, I tried with the version 2.8.1 and the error disappeared