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 elements on a 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 which according to the documentation http://lokeshdhakar.com/projects/lightbox2/#options it should be

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

      

however I am getting the error

lightbox.option is not a function

      

So how do I set the parameters I want?

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

edit2: also the parameters snippet is inside the finished document

edit3: lightbox loaded and works fine

+3


source to share


2 answers


As it turns out it has something to do with the version, I used the version 2.7.1

, I tried with the version 2.8.1

and the error went away



+3


source


Change the id of this <div id="lightbox">

to something else. Browsers automatically turn all identifiers into global variables, and this overwrites the global object lightbox

.



0


source







All Articles