Results 1 to 5 of 5

Thread: call lightbox using javascript

  1. #1
    Join Date
    Oct 2009
    Posts
    9
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default call lightbox using javascript

    Speaking about lightbox 2.03.

    Do you know how to call lightbox gallery with rel="exmaple1" from javascript?

    like onClick="javascript:exmaple1"

    Does anyone know? with jQuery would be alright too..


    Thank you for any help!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    In future, please post new questions in a new thread like here where I've moved this post, and:

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format when asking a question.


    To answer your question though, you can do, say your anchor that you want activated has an id:

    Code:
    <a href="some_big.jpg" id="image_2" rel="lightbox"><img src="some_small.jpg" alt=""></a>
    To activate it from javascript:

    Code:
    myLightbox.start(document.getElementById('image_2')).apply(document.getElementById('image_2'));
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I get a javascript error when I do this: myLightbox is not defined.

  4. #4
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    We need a link to the page in order to help.

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by kevpatts View Post
    I get a javascript error when I do this: myLightbox is not defined.
    Open a new thread for a new question.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •