【www.gdgbn.com--jquery】
代码如下
<script type="text/网页特效" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//get all the li from the #tabmenu ul
$("#tabmenu > li").click(function(){
//remove the selected class from all li
$("#tabmenu > li").removeclass("selected");
//reassign the li
$(this).addclass("selected");
//hide all the div in .boxbody
$(".boxbody div").slideup("1500");
//look for the right div in boxbody according to the navigation ul index, therefore, the arrangement is very important.
$(".boxbody div:eq(" + $("#tabmenu > li").index(this) + ")").slidedown("1500");
}).mouseo教程ver(function() {
//add and remove class, personally i dont think this is the right way to do it, anyone please suggest
$(this).addclass("mouseover");
$(this).removeclass("mouseout");
}).mouseout(function() {
//add and remove class
$(this).addclass("mouseout");
$(this).removeclass("mouseover");
});
//mouseover with animate effect for category menu list
$(".boxbody #category li").mouseover(function() {
//change background color and animate the padding
$(this).css教程("backgroundcolor","#888");
$(this).children().animate({paddingleft:"20px"}, {queue:false, duration:300});
}).mouseout(function() {
//change background color and animate the padding
$(this).css("backgroundcolor","");
$(this).children().animate({paddingleft:"0"}, {queue:false, duration:300});
});
//download by http://www.111cn.net
//mouseover effect for posts, comments, famous posts and random posts menu list.
$(".boxbody li").click(function(){
window.location = $(this).find("a").attr("href");
}).mouseover(function() {
$(this).css("backgroundcolor","#888");
}).mouseout(function() {
$(this).css("backgroundcolor","");
});
});
</script>
body{font-family:arial;font-size:10px;color:#ccc;background-color:#555}
a {color:#ccc;text-decoration:none;}
a:hover {color:#ccc;text-decoration:none}
#tabmenu {margin:0;padding:0 0 0 15px;list-style:none;}
#tabmenu li {float:left;height:32px;width:39px;cursor:pointer;cursor:hand}
li.comments {background:url(images/tabcomment.gif) no-repeat 0 -32px;}
li.posts {background:url(images/tabstar.gif) no-repeat 0 -32px;}
li.category {background:url(images/tabfolder.gif) no-repeat 0 -32px;}
li.famous {background:url(images/tabheart.gif) no-repeat 0 -32px;}
li.random {background:url(images/tabrandom.gif) no-repeat 0 -32px;}
li.mouseover {background-position:0 0;}
li.mouseout {background-position:0 -32px;}
li.selected {background-position:0 0;}
.box {width:227px}
.boxtop {background:url(images/boxtop.gif) no-repeat;height:11px;clear:both}
*html .boxtop {margin-bottom:-2px;}
.boxbody {background-color:#282828;}
.boxbottom {background:url(images/boxbottom.gif) no-repeat;height:11px;}
.boxbody div {display:none;}
.boxbody div.show {display:block;}
.boxbody #category a {display:block;}
.boxbody div ul {margin:0 10px 0 25px;padding:0;width:190px;list-style-image:url(images/arrow.gif)}
*html .boxbody div ul {margin-left:10px;padding-left:15px;}
.boxbody div li {border-bottom:1px dotted #8e8e8e; padding:4px 0;cursor:hand;cursor:pointer;}
.boxbody div ul li.last {border-bottom:none}
.boxbody div li span {font-size:8px;font-style:italic; color:#888;}
jquery tabbed side menu from queness webblog