<!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>table选项卡</title>
<style type="text/css">
body, ul, li, div{ margin:0px; padding:0px;}
ul{ list-style:none;}
a{ text-decoration:none; color:#999;}
.wrap{ width:400px; height:400px; overflow:hidden; margin:30px;}
.link{ background:#063; display:block; height:34px; line-height:34px; padding:0px 15px; cursor:pointer;}
.menu{ width:400px; height:200px; background:#CCC; color:#999 ; padding-top:35px; }
.menu a{ margin-right:10px; height:24px; line-height:24px;}
</style>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
</head>
<body>
<div class="wrap" >
<a class="link" href="#">网站导航</a>
<div class="menu">
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
<a href="#">网站链接</a>
</div>
</div>
<script type="text/javascript">
function showMore(targetItem,hideItem){
var $timer= null;
var $targetItem=$(targetItem);
var $hideItem=$(hideItem);
$hideItem.hide();
$targetItem.hover(function(){
clearTimeout($timer);
$hideItem.slideDown();
},function(){
$timer=setInterval(function(){
$hideItem.slideUp();
},300)
}
)
$hideItem.hover(function() {
clearTimeout($timer);
},function(){
$timer=setInterval(function(){
$hideItem.slideUp();
},300)
});
}
showMore(".link",".menu")
</script>
</body>
</html>
jquery 隐藏/显示(改进版)
最新推荐文章于 2024-02-20 11:02:57 发布