<div class="codetitle"> <span><a style="CURSOR: pointer" data="56910" class="copybut" id="copybut56910" onclick="doCopy('code56910')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code56910"> <br> <br><br> <br> <br> <title>Jquery的Tabs内容轮换效果实现代码,几行搞定</title> <br><script language="javascript" type="text/javascript" src="/Scripts/jquery-1.4.4.min.js"></script> <br> <style type="text/css"> <BR> * { margin:0; padding:0;} <BR> body { font:12px Verdana, Geneva, sans-serif; color:#404040;} <BR> .tabs { margin:10px 0 0 20px; width:360px; position:relative; overflow:hidden; height:1%; height:160px;} <BR> .tabs span { z-index:2; font-size:12px; border:1px solid #d5d5d5; width:95px; height:25px; line-height:25px; text-align:center; float:left; margin-right:5px; cursor:pointer;} <BR> span.active { background-position:0 -25px; background-color:#d5d5d5;} <BR> #tab-01, #tab-02, #tab-03 { position:absolute; top:26px; left:0; width:338px; padding:10px; height:93px; border:1px solid #d5d5d5; z-index:1;} <BR> #tab-02, #tab-03 { display:none;} <BR> </style> <br> <script type="text/javascript"> <BR> $(document).ready(function () { <BR> $('.tabs span').mouseover(function () { <BR> //div隐藏<BR> $('.tabs div').hide();<BR> //查找.tabs span同辈元素span 后面紧邻的同辈元素div显示<BR> $(this).siblings('span').removeClass('active').end().addClass('active').next('div').show(); <BR> }); <BR> }); <BR> </script> <br> <br><br> <br> <div class="tabs"> <br> <!-- 默认第一个tab为激活状态 --> <br> <span class="active">热点新闻</span> <br> <div id="tab-01">news</div> <br> <span>娱乐新闻</span> <br> <div id="tab-02">enteriment</div> <br> <span>就业形势</span> <br> <div id="tab-03">jobs</div> <br> </div> <br> <br> <br> </div>