1. Hyperlink hint effect
Hyperlinks come with a hint of the effect, here you define their own cue effect together can be compared. The sample code is as follows:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" ><html><head><meta http-equiv="Content-type" Content="text/html; charset=gb18030 "><title>JQuery Test</title><script type ="text/javascript" src ="Jquery.js" ></script><script type ="Text/javascript">$ (document). Ready ( function(){ varx =Ten;vary = -; $("A.tooltip"). MouseOver ( function(e){ This. MyTitle = This. title; This. title ="";vartooltip ="<div id = ' ToolTip ' >"+ This. mytitle+"</div>"; $("Body"). Append (tooltip);//Append it to the document$("#tooltip"). CSS ({"Top":(e.pagey+y) +"px","left":(e.pagex+x) +"px","Color":"#00ff00"}). Show ("Fast");//set X and Y coordinates, and display}). Mouseout ( function(){ This. title = This. MyTitle; $("#tooltip"). Remove ();//Removal}). MouseMove ( function(e){$("#tooltip"). CSS ({"Top":(e.pagey+y) +"px","left":(e.pagex+x) +"px","Color":"#00ff00"}); });});</script></head><body><p><a href ="#" class ="tooltip" title =" This is my hyperlink tip 1. " >Tip 1.</a></P><p><a href ="#" class ="tooltip" title ="This is my hyperlink tip 2." >Tip 2.</a></P><p><a href ="#" title ="comes with hint 1." >Bring your own hint 1.</a></P><p><a href ="#" title ="comes with hint 2." >Bring your own hint 2.</a></P></body></html>
The results are as follows:
You can see that the custom hints effect works better. And you can set the style more, is the Web page looks more beautiful.
2, Photo tip effect
The sample code is as follows:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" ><html><head><meta http-equiv="Content-type" Content="text/html; charset=gb18030 "><title>JQuery Test</title><script type ="text/javascript" src ="Jquery.js" ></script><script type ="Text/javascript">$ (document). Ready ( function(){ varx =Ten;vary = -; $("A.tooltip"). MouseOver ( function(e){ This. MyTitle = This. title; This. title ="";varImgtitle = This. myTitle?"<br/>"+ This. mytitle:+"";vartooltip ="<div id = ' tooltip ' >+ This. href+"' alt = ' picture preview '/> '+ This. mytitle+"</div>";//This place should pay special attention to add single quotation marks to this.href outside$("Body"). Append (tooltip);//Append it to the document$("#tooltip"). CSS ({"Top":(e.pagey+y) +"px","left":(e.pagex+x) +"px","Color":"#00ff00"}). Show ("Fast");//set X and Y coordinates, and display}). Mouseout ( function(){ This. title = This. MyTitle; $("#tooltip"). Remove ();//Removal}). MouseMove ( function(e){$("#tooltip"). CSS ({"Top":(e.pagey+y) +"px","left":(e.pagex+x) +"px","Color":"#00ff00"}); });});</script></head><body><ul><li><a href ="Http://img0.bdstatic.com/img/image/shouye/sheying0617.jpg" class ="tooltip" title ="Bird"><img src ="Http://img0.bdstatic.com/img/image/shouye/sheying0617.jpg" Alt ="Bird photo" /></a></li><li><a href ="Http://img0.bdstatic.com/img/image/shouye/bizhi0617.jpg" class ="tooltip" title ="Flowers" ><img src ="Http://img0.bdstatic.com/img/image/shouye/bizhi0617.jpg" Alt ="Flower picture" /></a></li></ul></body></html>
The results are as follows:
jquery Development hyperlink hints effect and picture hint effect