关于jquery的slideToggle()效果重复使用的问题
原地址:http://bbs.blueidea.com/thread-3038155-1-1.html
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="css/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".nav_title").click(function(){
$(".nav_sub").slideToggle("slow");
});
});
</script>
<style>
.nav_sub {
display:none;
}
</style>
</head>
<body>
<ul class="nav">
<li class="nav_title">期货订购会
<ul class="nav_sub">
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
</ul>
</li>
<li class="nav_title">期货订购会
<ul class="nav_sub">
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
</ul>
</li>
</ul>
</body>
</html>
.nav横向隐藏
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="css/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".nav_title").click(function(){
$(this).find(".nav_sub").slideToggle("slow");
});
$(".nav_hide").click(function(){
$(".nav").slideToggle("slow");
});
});
</script>
<style>
.nav_sub {
display:none;
}
.nav_hide{
float:left;
}
.nav{
float:left;
}
</style>
</head>
<body>
<ul class="nav">
<li class="nav_title">期货订购会
<ul class="nav_sub">
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
</ul>
</li>
<li class="nav_title">期货订购会
<ul class="nav_sub">
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
</ul>
</li>
</ul>
<div class="nav_hide">hide</div>
</body>
</html>
单显
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="css/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".nav_title").click(function(){
$(this).find(".nav_sub").slideToggle("slow");
});
});
</script>
<style>
.nav_sub {
display:none;
}
</style>
</head>
<body>
<ul class="nav">
<li class="nav_title">期货订购会
<ul class="nav_sub">
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
</ul>
</li>
<li class="nav_title">期货订购会
<ul class="nav_sub">
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
<li class="nav_con">我的订单</li>
</ul>
</li>
</ul>
</body>
</html>