jquery鼠标移上显示隐藏菜单完美版

迈不过友情╰ 2022-08-12 16:11 322阅读 0赞
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=7" />
  7. <title>鼠标移上显示隐藏菜单</title>
  8. <style type="text/css">
  9. *{margin:0;padding:0;}
  10. body { font-size: 13px; line-height: 130%; padding: 60px }
  11. #panel { width: 300px; border: 1px solid #0050D0 }
  12. .head { padding: 5px; background: #96E555; cursor: pointer }
  13. .content { padding: 10px; text-indent: 2em; border-top: 1px solid #0050D0;display:block; }
  14. </style>
  15. <script src="jquery.min.js" type="text/javascript"></script>
  16. <script type="text/javascript">
  17. $(function(){
  18. var isShow=false;
  19. $(".content").hide();
  20. $("#panel h5.head").mouseover(function(){
  21. $(".content").show();
  22. });
  23. $(".content").mouseover(function(){
  24. isShow=true;
  25. $(this).show();
  26. });
  27. $(".content").mouseout(function(){
  28. if(isShow){
  29. $(this).hide();
  30. isShow=false;
  31. }
  32. });
  33. });
  34. </script>
  35. </head>
  36. <body>
  37. <div id="panel">
  38. <h5 class="head">什么是jQuery?</h5>
  39. <div class="content">
  40. jQuery是继Prototype之后又一个优秀的JavaScript库,它是一个由 <a href="http://www.baidu.com/" target="_blank">John Resig</a> 创建于2006年1月的开源项目。jQuery凭借简洁的语法和跨平台的兼容性,极大地简化了JavaScript开发人员遍历HTML文档、操作DOM、处理事件、执行动画和开发Ajax。它独特而又优雅的代码风格改变了JavaScript程序员的设计思路和编写程序的方式。
  41. </div>
  42. </div>
  43. </body>

发表评论

表情:
评论列表 (有 0 条评论,322人围观)

还没有评论,来说两句吧...

相关阅读