JSFiddle - React, Tailwind, and code Playground
HTML
<body onload="createLinks()">
<div id="container">
<div id="content"></div>
<pre id="col"></pre>
<a onmouseover="openManu('Any manufacturer')" onmouseout="mouseOut()" onClick="openWeb('http://www.barnlightelectric.com/')">Any manufacturer</a>
</div>
</body>
CSS
#container{
width:300px;
margin-top:2em;
font-size:1.1em;
position:relative;
padding-left:20px;
display:inline-block;
background-color:#3C3C4E;}
#content{
width:300px;
z-index:1;
display:none;
font-size:16px;
font-family: 'Raleway', sans-serif;
position:absolute;
padding:10px;
background-color:white;}
a {
cursor:pointer;
padding:0;
display:inline-block;
margin:0;
color: white;
font-family: 'Raleway', sans-serif;
position:inherit;
}
h4 {
padding:0;
z-index:0;
display:inline-block;
margin:0;
color: white;
font-family: 'Raleway', sans-serif;
font-weight:normal;
font-size:15px;
background-color:#3C3C4E;
position:absolute;
left:8px;
padding:24px;
top:400px;
width:842px;
}
pre {
display:block;
float:left;
line-height:21px;
}
JavaScript
var arr =
[
{
"Manufacturer": "Any manufacturer",
"Description": "Traditional values",
"URL": "http://www.website.com"
},
{
"Manufacturer": "Different Manufacturer",
"Description": "Short description of said manufacturer",
"URL": "http://www.website2.com"
},
{
"Manufacturer": "A Similar Manufacturer",
"Description": "Not quite the same as the previous manufacturer",
"URL": "http://www.website3.com"
},
{
"Manufacturer": "Manufacturer",
"Description": "Essentially a ripoff of the first manufacturer",
"URL": "http://www.website4.com"
}
]
function createLinks() {
for (var i=0; i<arr.length; i++){
var obj = arr[i];
var m = obj["Manufacturer"];
if (manu == m) {
URL = obj["URL"];
}
}
document.getElementById('col').innerHTML = "<a onmouseover=\"openManu(" + m + ") onmouseout=\"mouseOut()\" onClick=\"openWeb(" + URL + ") >" + m + "</a>";
}
function openManu(manu) {
document.getElementById('content').style.display = 'block';
for (var i=0; i<arr.length; i++){
var obj = arr[i];
var m = obj["Manufacturer"];
if (manu == m) {
desc = obj["Description"];
}
}
document.getElementById('content').innerHTML = desc;
}
window.onmousemove = function (e) {
var tooltipSpan = document.getElementById('content');
var x = e.clientX,
y = e.clientY;
tooltipSpan.style.top = (y - 20) + 'px';
tooltipSpan.style.left = x + 'px';
}
var mouseOut = function(){
document.getElementById('content').style.display = 'none'
}
function openWeb(URL) {
window.open(URL);
}