en.javascript.info/2-ui/2-events/03-event-delegation/4-behavior-tooltip/source.view/index.html
Ilya Kantor dc904d122e cleanup
2018-10-22 12:02:28 +03:00

43 lines
1 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<style>
body {
height: 2000px;
/* make body scrollable, the tooltip should work after the scroll */
}
.tooltip {
/* some styles for the tooltip, you can use your own instead */
position: fixed;
padding: 10px 20px;
border: 1px solid #b3c9ce;
border-radius: 4px;
text-align: center;
font: italic 14px/1.3 sans-serif;
color: #333;
background: #fff;
box-shadow: 3px 3px 3px rgba(0, 0, 0, .3);
}
</style>
</head>
<body>
<p>LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa</p>
<p>LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa LaLaLa</p>
<button data-tooltip="the tooltip is longer than the element">Short button</button>
<button data-tooltip="HTML<br>tooltip">One more button</button>
<p>Scroll the page to make buttons appear on the top, check if the tooltips show up correctly.</p>
<script>
// ...your code...
</script>
</body>
</html>