常用的js效果
使用jquery实现鼠标悬停显示层
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script type="text/javascript" src="jquery-1.8.1.min.js"></script> </head> <body> <div id="mydiv1" style="position:absolute;display:none;border:1px solid silver;background:silver;"> 提示1效果 </div> <div id="mydiv2" style="position:absolute;display:none;border:1px solid silver;background:silver;"> 提示2效果 </div> <a id="t1" onMouseOver="javascript:show(this,'mydiv1');" onMouseOut="hide(this,'mydiv1')">鼠标放上去1</a> <br><br><br><br><br> <a id="t2" onMouseOver="javascript:show(this,'mydiv2');" onMouseOut="hide(this,'mydiv2')">鼠标放上去2</a> <script type="text/javascript"> function show(obj,id) { var objDiv = $("#"+id+""); $(objDiv).css("display","block"); $(objDiv).css("left", event.clientX); $(objDiv).css("top", event.clientY + 10); } function hide(obj,id) { var objDiv = $("#"+id+""); $(objDiv).css("display", "none"); } </script> </body> </html>
代码来自网络