Question - How to trigger javascript hyperlinks in an SVG?
I need to present facsimile copies of articles I've written, with clickable links, on my portfolio webpage.The approach that seems likeliest to work is imagemaps in svgs, because the hyperlink retains its position on the image as the image responds to different screen sizes.
Using svgs, I've succeeded in making responsive images with links, embedded in another page. Now my problem is to make those links trigger a javascript plugin (Floatbox) that presents overlays.
The overlays are important, because they're my best option for keeping readers on the page. I don't want them opening new pages to read a footnote. I want them to be able to glance at important but secondary material, close it, and return to what they were reading before.
I can't get the javascript calls required for such overlays to work, and in fact I keep breaking the imported .svg when I try to change the code.
Ordinarily, I'd trigger such a link with something like this:
<a href="LinkFromFacsimileStoryImage.html" class="floatbox" data-fb-
options="width:80% height:80% scrolling:yes">LinkName</a>
Suffice it to say that I have no idea why adobe isn't presenting the code. I followed the guidelines for pasting it in, and it is showing up on my screen as I edit the draft. But I don't see it when I post the question.
So here's what the page ought to be presenting:
<a href="website/" class="floatbox" data-fb-
options="width:80% height:80% scrolling:yes">Website Function</a>
The code doesn't work in an .svg. In hopes that some browsers may actually present the code, here's how I have a sample page set up now, with a greatly truncated representation of the imported image, just for context, and the link presented in its native (unaltered) state:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Declaration</title>
<link type="text/css" rel="stylesheet" href="floatbox/floatbox.css" />
<script type="text/javascript" src="floatbox/floatbox.js"></script>
</head>
<body>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 882.5 245.9" style="enable-background:new 0 0 882.5 245.9;" xml:space="preserve">
<style type="text/css">
.st0{opacity:0.35;fill:#FFFFFF;stroke:#000000;stroke-miterlimit:10;}
</style>
<image style="overflow:visible;" width="750" height="209" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAu4AAADRCAYAAACTrj
WiZHqpWs2ra3VpcUIHa9SXqqpTl7bIMTyBQNNl13NkAT59pgAWq1evp/A/lH6dv6rBKPAAAAAElF
TkSuQmCC" transform="matrix(1.1767 0 0 1.1767 0 0)">
</image>
<a xlink:href="https://www.loc.gov/resource/rbc0001.2004pe76546/?sp=1" >
<rect x="94.5" y="67.5" class="st0" width="773" height="55"/>
</a>
</svg>
</body>
</html>
In case they don't, my mockup of the state of the project as it stands now may be found at https://codepen.io/ChrisRichard/pen/qwLMEL
However, it doesn't look like I can post the plugin's javascript and CSS there because they're proprietary. I'll see what I can do about alternatives on that. Meanwhile, somebody could certainly edit in a different javascript call that I and others could extrapolate from, and I've saved the project as a template to facilitate that.
I should point out that there's a lot I don't know about the language of coding. I'm self-taught. So the more specific the suggestions, the better.
Thanks in advance for any suggestions.
