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.
Bookmarks