Help make sure that when you hover the mouse over a div, the text jumped over it (hint). Any standard function can eat? If there is no such means, I think you can create another div and make it invisible, and show it on hover (but this is in my opinion a new bicycle).

<div id="aaa" onmouseout="funk2()" onmouseover="funk1()" </div> <div id="aaa2"></div> <style> #aaa { position: absolute; top: 0px; left:0px; width: 50px; height: 50px; z-index: 1; } #aaa2 { position: absolute; top: 0px; left: 0px; width: 50px; height: 50px; z-index: 2; visibility: hidden; } </style> <script> function funk1() { id: aaa2.style.style.visibility = "visable"; } function funk2() { id: aaa2.style.style.visibility = "hidden"; } </script> 

I looked at the examples, but something, they are so scary (maybe even cross-browser compatibility). Rather, I did not understand anything. But I think this could be made easier. For example:

  <!DOCTYPE HTML> <html> <title>aaa</title> <head> <style> #aaa { position: absolute; top: 0px; left:0px; width: 50px; height: 50px; z-index: 1; background:red; } #aaa2 { position: absolute; top: 0px; left: 0px; width: 100px; height: 20px; z-index: 2; visibility: hidden; background:yellow; } #spantext { position: absolute; top: 0px; left: 0px; font:10px/1.5em Arial,serif; } </style> <script> timer=null; function funk1(ideelementa,ideelementatext,text) { id: ideelementatext.style.text = text;\\\ ето не правильно. timer = setInterval(function(){move(ideelementa)},10); id: ideelementa.style.visibility = "visable"; } function funk2(ideelementa) { clearInterval(timer) id: ideelementa.style.visibility = "hidden"; } function move(ideelementa) { mouse_x=functiongetmouse_x() ; mouse_y=functiongetmouse_y() ; id: ideelementa.style.left =mouse_x+"px"; id: ideelementa.style.top =mouse_y+"px"; } function functiongetmouse_x() { mousex=\\.........как не знаю return (mousex); } function functiongetmouse_y() { mousey=\\.........как не знаю return (mousey); } </script> </head> <body> <div id="aaa" onmouseout="funk2(aaa2,spantext,какойто текст)" onmouseover="funk1(aaa2)" </div> <div id="aaa2"><span id="spantext"></span></div> </body> </html> 

At that time, when I thought about this method. I found that there is a title property). For example: <span id = "ide" title = "some kind of text"> But it works 1 time if you don’t mind the element.

  • You’re doing everything right. Standard tools do not allow styling messages, so they write such solutions. There are alt and title attributes in pictures, but you cannot achieve beautiful windows. - koza4ok
  • And now add AI here to calculate exactly where to pop up (to, for example, take into account the location of the element at the window borders) - up, down, right or left of the cursor, adjusting the size of the tooltip depending on the size or style of the text, support markup In the tooltip, set the interval through which you need to emerge, if necessary, make the settings ... and a bunch of useful little things - and it will turn out the same thing that has already been invented a thousand times and for some reason called "scary" :-) There is nothing really to be understood there, just one read the readme once and see examples. - user6550
  • Clearly, I'm going to learn the Java script. And study the "scary" examples. For now, I’ll have enough title. - Sirius
  • Found not a "scary" example host-biz.com/tooltips.html ) - Sirius

1 answer 1

Do not reinvent the bike, there are many ready-made, customizable in wide ranges, and cross - browser solutions .