WEB简单通用的选项卡效果

WEB简单通用的选项卡效果 效果图:

WEB简单通用的选项卡效果

代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>animate tabs</title>

	<script type="text/javascript" src="http://www.ihiro.org/cases/js/jquery-1.3.2.min.js"></script>       
    <style type="text/css">
		* { margin:0; padding:0;}
		body { font:12px Verdana, Geneva, sans-serif; color:#404040;}
		/*
		.tabs { margin:10px 0 0 20px; width:360px; position:relative; overflow:hidden; height:1%; height:140px;}
		.tabs h3 { z-index:2; font-size:12px; background:url(http://www.ihiro.org/cases/tabs/pic.gif) no-repeat; width:95px; height:25px; line-height:25px; text-align:center; float:left; margin-right:5px;}
		h3.active { background-position:0 -25px; color:#fff;}
		h3.over{cursor:pointer;}
		#tab-01, #tab-02, #tab-03 { position:absolute; top:24px; left:0; width:338px; padding:10px; height:93px; border:1px solid #ace; z-index:1;}
		#tab-02, #tab-03 { display:none;}
		*/
		
			.tabs { margin:10px 0 0 20px; width:600px; position:relative; overflow:hidden; height:1%; height:400px;  background-color:#F66}
		.tabs h3 { z-index:2; font-size:12px; background:url(http://www.ihiro.org/cases/tabs/pic.gif) no-repeat; width:95px; height:25px; line-height:25px; text-align:center; float:left; margin-right:5px;}
		h3.active { background-position:0 -25px; color:#fff;}
		h3.over{cursor:pointer;}
		#tab-01, #tab-02, #tab-03 { position:absolute; top:24px; left:0; width:580px; padding:10px; height:350px; border:1px solid #ace; z-index:1;}
		#tab-02, #tab-03 { display:none;}
    </style>
    <script type="text/javascript">
	$(document).ready(function() {
		$('.tabs h3').mouseover(function(){$(this).siblings('h3').addClass('over');})
		.click(function() {
			$('.tabs div').hide();
			$(this).siblings('h3').removeClass('active').end()
								  .addClass('active').next('div').show();
		});		
	});
    </script>
</head>
<body>
	<div class="tabs">
    	<!-- 默认第一个tab为激活状态 -->
        <h3 class="active"><span>热点新闻</span></h3>
        <div id="tab-01">news</div>
	    <h3><span>娱乐新闻</span></h3>
        <div id="tab-02">enteriment</div>
        <h3><span>就业形势</span></h3>
        <div id="tab-03">jobs</div>
    </div>
</body>
</html>


你可能感兴趣的:(Web)