user1308534
user1308534

Reputation: 43

jQuery Lightbox. Can't find method

I'm surely having a simple issue here but just can't get hold of it. I would like to trigger lightbox with jquery as described here but it just won't do. .lightBox() Method can not be found and I just don't understand why.

Code is

<!-- jquery lighbox addon -->
<script type="text/javascript" src="files/jquery.lightbox-0.5.js"></script>

<!-- Lightbox active for all a elements with longdesc="lb" -->
<script type="text/javascript">
     $(function() {
         $('a[longdesc="lb"]').lightBox();
     });
</script>

And error message is

Uncaught TypeError: Object [object Object] has no method 'lightBox'

Thanks a million for your help in advance!

Upvotes: 2

Views: 748

Answers (1)

Jordan
Jordan

Reputation: 32522

You need to download lightbox, extract it out, and copy the jquery.lightbox-0.5.js file into your /files/ folder. Verify that your path to the file is correct relative to the HTML file you are running this from, or you can make it absolute by putting a leading slash in front of files, like /files/jquery.lightbox-0.5.js.

Upvotes: 1

Related Questions