Search code examples
jqueryhtmlcsstooltip

How to make a popup div hover over a link in jquery?


How to make a popup hover over a link in jquery?

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

Solution

  • the jquery

    $("#floatbar").click(function(e){
        e.preventDefault();
        $(this).find(".popup").fadeIn("slow");
    });
    

    the css

    #floatbar {
        position:relative;
    }
    
    .popup {
        position:absolute;
        top:10px;
        left:0px;
        height:30px;
        background:#ccc;
        display:none;
    }
    

    the html

    <a id="floatbar" href="#">
        <div class="popup">Hi there</div>
        click here
    </a>