How to make popup div hover over 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> 
+7
source share
3 answers

jquery

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

css

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

html

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

Pure css solution:

 <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; } 

All you have to do is add <div class="box">(popup text)</div> under the link, and it will work for every link with this field.

http://jsfiddle.net/mcdqt/

+10
source

Perhaps easier when you use something like Fancybox for jQuery or another Lightbox alternative?

+1
source

All Articles