How Do I Link A Hyperlink To An Html5
This is a responsive HTML5 gallery that I've been working on recently. I just want each image to link to a different page.
Solution 1:
You can access the values in data-attributes (
data-*
) using.dataset
(currently supported in all major browsers). I.e. to access the value of the attributedata-src
of an element, you would write:var srcValue = varHoldingElemNode.dataset.src; // orvar srcValue = varHoldingElemNode.dataset["src"];
That said, you can use some JS to achieve what (I suppose) you want: turning a
<div data-src=<url_to_image>...
into an image linking to some page.See, also, this short demo.
Post a Comment for "How Do I Link A Hyperlink To An Html5