Results 1 to 3 of 3

Thread: call lightbox with JavaScript event handlers

  1. #1
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default call lightbox with JavaScript event handlers

    I want to call Lightbox with a JavaScript OnClick event. Could you tell me how this is done? I have tried this:
    Code:
    myLightbox.start(document.getElementById('image_2')).apply(document.getElementById('image_2'));
    but can't make it work.
    Thank you
    To see the page I'm using this on follow this link:
    http://fastngoodwebsites.com/victori...tbox_test.html
    I am trying to make a whole table row clickable to present Lightbox photos.
    Last edited by sifaka; 01-30-2012 at 04:31 PM.

  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

    That version of Lightbox has no myLightbox. Even if it did, there are no rel="lightbox" links on that page that you could be trying to invoke that way. And you are using jQuery on that page for the slideshow.

    So I'd suggest switching to Slimbox2 (also jQuery based) for the lightbox duties:

    http://www.digitalia.be/software/slimbox2

    Once installed, you can launch a Slimbox lightbox from javascript as described here:

    http://code.google.com/p/slimbox/wik...avascript_code

    Slimbox will also launch ordinary rel="lightbox" links in the normal manner.

    You only need one copy of jQuery for the page, but I'd suggest updating to version 1.6.4 which can be done simply by changing the numbers in the tag as shown:

    Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
    - John
    ________________________

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

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    sifaka (01-30-2012)

  4. #3
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Jscheuer1,
    Thanks! It works like a charm and is valid XHTML. After putting a css {cursor: pointer;} in the class, the entire table row works like a link that opens a lightbox.

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
  •