-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
33 lines (25 loc) · 962 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var imagetip = document.getElementById('imagetip');
var imagetipLink = document.getElementById('imagetip-link');
var imagetipContent = document.getElementById('imagetip-content');
var image = document.querySelector('img');
image.addEventListener('mousemove', function(e) {
var hotspot = e.target;
var x = e.offsetX;
var y = e.offsetY;
imagetip.style.display = 'block';
imagetip.style.top = e.clientY + 'px';
imagetip.style.left = e.clientX + 'px';
imagetipContent.innerHTML = ''; // Clear previous content
var popupImage = document.createElement('img');
popupImage.src = hotspot.popimg;
console.log("jax: img is " + hotspot.href)
popupImage.alt = 'Popup Image';
imagetipContent.appendChild(popupImage);
imagetipLink.href = hotspot.href;
imagetip.addEventListener('mousemove', function() {
imagetip.style.display = 'block';
});
});
image.addEventListener('mouseleave', function() {
imagetip.style.display = 'none';
});