Results 1 to 5 of 5

Thread: lightbox without a link

  1. #1
    Join Date
    Jul 2005
    Posts
    39
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Question lightbox without a link

    1) Script Title: Lightbox image viewer 2.03a

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...box2/index.htm

    3) Describe problem: extend functionality

    Is it possible to modify this lightbox code (or any lightbox code, for that matter) so that the lightbox effect can be evoked without the usual "href" link tag? Using something else like onclick on an image tag, for example?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,939
    Thanks
    43
    Thanked 3,193 Times in 3,156 Posts
    Blog Entries
    12

    Default

    Yes, that probably could be done with a bit of modification of the lightbox script, probably more than just a little bit. However, I see no reason to. If you want lightbox activated onclick of an image, you may do this:

    HTML Code:
    <a href="some.jpg" rel="lightbox" title="Some Picture"><img 
    src="some_thumb.jpg" style="border:none;"></a>
    Incidentally, if you happen to have an image map, lightbox can initialize on an area tag as well:

    HTML Code:
    <area rel="lightbox" shape="rect" coords="0, 22, 30, 60" href="some.jpg" title="Some Picture">
    So an href link is not required, but an href link or an href area tag is.

    This is actually an accessibility feature for search engines indexing your site, as well as for users who have javascript disabled.
    - John
    ________________________

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

  3. #3
    Join Date
    Jul 2005
    Posts
    39
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thank you, Supreme Allied Coder. I just need to implement a lightbox-style effect on images which cannot have "a href" links around them, because that would mess up other things. Accessibility isn't really an issue in this particular case, and I can't introduce imagemaps.

    Anyhoo, it's nice to know it's possible, though...!

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,939
    Thanks
    43
    Thanked 3,193 Times in 3,156 Posts
    Blog Entries
    12

    Default

    I would consider working out the modifications, or finding a more suitable script for you if I knew exactly why. That often makes a big difference in how the code would need to work. Also, I'm still not convinced this is necessary. Regardless of whether or not a link is present, the images (if they can be seen at all) can still be directly navigated to. If it is a problem with another script editing/modifying all href links (or just lightbox links plus its own links) on a page, and thus messing up lightbox, that other script could probably more easily be made to exclude rel="lightbox" links than one could edit lightbox itself for this purpose.
    - John
    ________________________

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

  5. #5
    Join Date
    Jul 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The problem is that some users will want to use Lightbox within a CMS wysiwyg. For example FCKeditor.

    If the image icon is encased within a <a href: ..etc></a>, the online editor will not consider it an image but a link... which has its own set of functions and panels. If we could evoke lightbox from an onclick() then this could happen within the image tag and therfore still be subject to the image controls of the wysiwyg.

    Please let me know if an onclick exists as I would like to incorporate ligthbox within my own wysiwyg.

    Kind regards

    Abiel M de Groot.

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
  •