免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1510 | 回复: 0

用JQuery做的Tag效果 [复制链接]

论坛徽章:
0
发表于 2011-04-20 14:10 |显示全部楼层
  1. 源码:

  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5.     <title></title>
  6.     <style type="text/css">
  7.         /* CSS Document 全局*/
  8. *{padding:0;margin:0;}
  9. html{border:0;width:100%;}
  10. body{font-family:Arail,"宋体",verdana;font-size:12px;line-height:1.5em;color:#666; }
  11. img{border:none;}input,select{vertical-align:middle; margin-right:2px;}
  12. ol,ul,li {list-style-image:none;list-style-position:outside;list-style-type:none;margin:0;padding:0;}
  13. ol, ul {list-style:none outside none;}
  14. em{font-style:normal;}
  15. a{text-decoration:none;color:#666;}
  16. a:hover,a:active{text-decoration:underline;color:#41ABCE;}
  17. a:visited{color:#666;}
  18. h1{font-size:16px;}h2,h3,h4{font-size:13px;}h5,h6{font-size:12px;}
  19. .left{ float:left;}
  20. .right{float:right;}
  21. .clear{ clear:both; }
  22. .Wrap{margin:0 auto 0;overflow:hidden;width:960px;}
  23. /*End 全局*/


  24. .seleListCont
  25. {
  26. clear:both;
  27. border-top:1px solid #39B3DA;
  28. padding-top:10px;
  29. width:200px;
  30. }

  31. .seleList {
  32. width:200px;
  33. }
  34. .seleList li {
  35. float:left;
  36. line-height:22px;
  37. }
  38. .seleList li a {
  39. line-height:22px;
  40. padding:0 10px;
  41. }
  42. .seleList li.hover {
  43. background:none repeat scroll 0 0 #FFFFFF;
  44. border-left:1px solid #39B3DA;
  45. border-right:1px solid #39B3DA;
  46. border-top:1px solid #39B3DA;
  47. bottom:-1px;
  48. margin-left:5px;
  49. position:relative;
  50. }
  51.   </style>
  52. </head>

  53. <script src="jquery-1.2.6.pack.js" type="text/javascript"></script>
  54. <script type="text/javascript">

  55.     // JavaScript Document
  56.     /*******************************************************************************
  57.     * 标题: TAB 选项
  58.     *******************************************************************************/

  59.     jQuery(function($) {
  60.         $("#Move ul li").mouseover(function() {
  61.             var s = $(this).parent().children().index(this); //寻找父级下子元素第几个
  62.             $(this).parent().children().removeClass("hover"); //寻找父级下子元素的hover Css样式
  63.             $(this).addClass("hover")
  64.             $(this).parent().parent().next()
  65.         .children().hide()
  66.         .eq(s).show();  //s元素显示
  67.         });

  68.     })

  69. </script>

  70. <body>
  71.     <div class="seleList" id="Move">
  72.         <ul>
  73.             <li class="hover"><a href="javascript:void(0);" title="">他的提问</a></li>
  74.             <li><a href="javascript:void(0);" title="">他的回答</a></li>
  75.         </ul>
  76.     </div>
  77.     <div class="seleListCont">
  78.         <ul>
  79.             <li><a href="#" title="都会电子城楼下内个万店通的联系方式??">都会电子城楼下内个万店通的...</a></li><li>
  80.                 <a href="#" title="深圳上空为什么每天都有直升机在飞?">深圳上空为什么每天都有直升...</a></li><li>
  81.                     <a href="#" title="华强北哪栋楼占得面积最大?">华强北哪栋楼占得面积最大?</a></li><li>
  82.                         <a href="#" title="华强北每天有多少人流?">华强北每天有多少人流?</a></li>
  83.         </ul>
  84.         <ul style="display: none;">
  85.             <li>11111</li>
  86.         </ul>
  87.     </div>
  88. </body>
  89. </html>
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP