en.javascript.info/2-ui/3-event-details/3-mousemove-mouseover-mouseout-mouseenter-mouseleave/1-behavior-nested-tooltip/task.md
Ilya Kantor 28a514a0d7 minor
2019-08-17 13:36:52 +03:00

726 B
Raw Permalink Blame History

importance: 5


Improved tooltip behavior

Write JavaScript that shows a tooltip over an element with the attribute data-tooltip. The value of this attribute should become the tooltip text.

That's like the task info:task/behavior-tooltip, but here the annotated elements can be nested. The most deeply nested tooltip is shown.

Only one tooltip may show up at the same time.

For instance:

<div data-tooltip="Here  is the house interior" id="house">
  <div data-tooltip="Here  is the roof" id="roof"></div>
  ...
  <a href="https://en.wikipedia.org/wiki/The_Three_Little_Pigs" data-tooltip="Read on…">Hover over me</a>
</div>

The result in iframe:

[iframe src="solution" height=300 border=1]