Reputation: 1040
I have a lot of thumbnails with small images in them, and when the user clicks on them, I want to open a different image file using pure Javascript, and I do not want to put the address of the bigger image in the call of the function:
onclick="loadLightBox('www....')"
As I think this is unclean.
I was wondering if it would be a ridiculous use of the longdesc attribute to provide the image location or is there another way I could do it? Ideally with pure JS rather than JQuery, even though if that is the best way then I will just do it from scratch
Upvotes: 1
Views: 572
Reputation:
You can also use the Custom Data Attributes in HTML5:
<img src="/img/thumbnail.jpg" data-big="/img/photo.jpg" />
Upvotes: 4