Description Box using “onmouseover”

后端 未结 6 1931
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 07:35

I am playing with the onmouseover event in javascript

I would like a little box to pop up and remain up until there is no onmouseover anymo

6条回答
  •  有刺的猬
    2020-12-08 07:56

    I'd try doing this with jQuery's .hover() event handler system, it makes it easy to show a div with the tooltip when the mouse is over the text, and hide it once it's gone.

    Here's a simple example.

    HTML:

    Some Text

    Tooltip Hint Text
    ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

    Basic CSS:

    ​#​tooltip {
    display:none;
    border:1px solid #F00;
    width:150px;
    }​
    

    jQuery:

    $("#testText").hover(
       function(e){
           $("#tooltip").show();
       },
       function(e){
           $("#tooltip").hide();
      });​​​​​​​​​​
    

提交回复
热议问题