Results 1 to 3 of 3

Thread: :: Lightbox image viewer 2.03a - remove hover title

  1. #1
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default :: Lightbox image viewer 2.03a - remove hover title

    1) Script Title: :: Lightbox image viewer 2.03a

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

    3) Describe problem: I would like to have captions on my lightbox slides, but if I designate a 'title' it also shows up when I hover the the link. Can I prevent the hover function? It looks weird and distracting on the site I am using this for.

  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

    Using a plain test editor like NotePad, edit the lightbox.js file. Around line number 361 you will find:

    Code:
    		function getImageTitle(anchor){ //DynamicDrive.com added function that allows the caption("title") to be linked ("rev").
    			var ddimageTitle=anchor.getAttribute('title')
    			var ddimageTitleURL=(ddimageTitle!=null && ddimageTitle!="")? anchor.getAttribute('rev') : null
    			return ddimageTitleFinal=(ddimageTitleURL!=null && ddimageTitleURL!="")? '<a href="'+ddimageTitleURL+'" class="ddcaptionurl">'+ddimageTitle+'</a>' : ddimageTitle
    		};
    Replace it with:

    Code:
    		function getImageTitle(anchor){ //DynamicDrive.com added function that allows the caption("title") to be linked ("rev").
    			var ddimageTitle=anchor.getAttribute('data-title')
    			var ddimageTitleURL=(ddimageTitle!=null && ddimageTitle!="")? anchor.getAttribute('rev') : null
    			return ddimageTitleFinal=(ddimageTitleURL!=null && ddimageTitleURL!="")? '<a href="'+ddimageTitleURL+'" class="ddcaptionurl">'+ddimageTitle+'</a>' : ddimageTitle
    		};
    And save. Use that version of the script. Now, instead of the title attribute of the link:

    Code:
    <a href="some.jpg" title="my caption" rel="lightbox">Whatever</a>
    do:

    Code:
    <a href="some.jpg" data-title="my caption" rel="lightbox">Whatever</a>
    Notes:

    • You may have to refresh the page and/or clear the browser cache in order to see the effects of these changes.

    • This will work on a page with any standards invoking DOCTYPE. But it's only w3c valid for an HTML 5 DOCTYPE.
    - 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:

    katebellami (08-09-2011)

  4. #3
    Join Date
    Jun 2010
    Posts
    59
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default Thank you!

    Brilliant - this worked perfectly. Much appreciated!!!

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
  •