<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>jquery实现菜单功能(单击展开或者关闭)-一般应用于后台</title>
<script src="js/jquery-1.11.1.min.js"></script>
<style>
.bor{border:10px solid yellow;}
.red{color:red;}
</style>
<script>
$(document).ready(function(e) {
//class=menu的h1的下一个元素:无类型
$('h1.menu').next().css('display','none');
//为class=menu的h1添加单击事件:显示时单击隐藏,隐藏时单击显示
$('h1.menu').click(function(){
//$(this).next().show();
//有此行菜单你允许打开一个
$('h1').next().css('display','none');
//$(this).next().is(":hidden") ? $(this).next().show() : $(this).next().hide();
var o = $(this).next();
o.is(':hidden') ? o.show() : o.hide();
});
$('#ddd').add('<b>ok</b>'
jquery实现菜单功能(单击展开或者关闭)-一般应用于后台
最新推荐文章于 2021-06-22 09:48:39 发布