如何让一个弹出式div悬停在jquery中的一个链接上?

Ste*_*ons 7 html css jquery tooltip

如何使弹出窗口悬停在jquery中的链接上?

<div id="floatbar">
    <a href="" onclick="make it float 10px under this yay">
</div>
Run Code Online (Sandbox Code Playgroud)

Ed *_*yed 12

jquery

$("#floatbar").click(function(e){
    e.preventDefault();
    $(this).find(".popup").fadeIn("slow");
});
Run Code Online (Sandbox Code Playgroud)

css

#floatbar {
    position:relative;
}

.popup {
    position:absolute;
    top:10px;
    left:0px;
    height:30px;
    background:#ccc;
    display:none;
}
Run Code Online (Sandbox Code Playgroud)

HTML

<a id="floatbar" href="#">
    <div class="popup">Hi there</div>
    click here
</a>
Run Code Online (Sandbox Code Playgroud)


Ste*_*ler 11

纯css解决方案:

<div id="floatbar">
    <a href="" onclick="make it float 10px under this yay">Link</a>
    <div class="box">Popup box</div>
</div>

.box {
     display:none;
     position: absolute;
     top: 30px; 
     left: 10px;
    background: orange;
    padding: 5px;
    border: 1px solid black;
}

a:hover + .box {
     display:block;   
}
Run Code Online (Sandbox Code Playgroud)

您所要做的就是<div class="box">(popup text)</div>在链接下方添加一个链接,它将适用于具有此类框的每个链接.

http://jsfiddle.net/mcdqt/