en.javascript.info/1-js/02-b/1-b1/2-hoverintent/source/index.html
Volodymyr Shevchuk fdc015e1fa Last changes
2021-05-03 15:15:32 +03:00

25 lines
584 B
HTML

<link rel="stylesheet" href="style.css">
<div id="elem" class="clock">
<span class="hours">12</span> :
<span class="minutes">30</span> :
<span class="seconds">00</span>
</div>
<div id="tooltip" hidden>Tooltip</div>
<script type="module">
import HoverIntent from './hoverIntent.js';
new HoverIntent({
elem,
over() {
tooltip.style.left = elem.getBoundingClientRect().left + 5 + 'px';
tooltip.style.top = elem.getBoundingClientRect().bottom + 5 + 'px';
tooltip.hidden = false;
},
out() {
tooltip.hidden = true;
}
});
</script>