/*
* control menu show or hide(expand and collapse)
*/
var status = [];
function menuOperation() { $("#menu li ul").on("click",function(){
return false;
})//阻止子元素冒泡 $("#menu .menu").on("click", function(){ var thisClass = $(this).attr("class");
if(thisClass != "isHide"){
$(this).attr("class", "isHide")
$(this).children().hide();
} else {
$(this).removeClass("isHide")
$(this).children().show();
}
})
} function keepOldStyle() {
var content = $("#menu").children(); for(var i=0; i<content.length; i++) {
var thisClass = content[i].classList;
//alert(thisClass);
if(thisClass == "isHide") {
content.eq(i).children().hide();
} else {
content.eq(i).children().show();
}
} }

 

jquery 实现 隐藏交替同时记住以前隐藏的样式的更多相关文章

  1. Jquery一个slideToggle搞定div的隐藏与显示

    Jquery一个slideToggle搞定div的隐藏与显示 <!DOCTYPE html> <html> <head> <script src=" ...

  2. jquery实现点击展开列表同时隐藏其他列表 js 对象操作 对象原型操作 把一个对象A赋值给另一个对象B 并且对象B 修改 不会影响 A对象

    这篇文章主要介绍了jquery实现点击展开列表同时隐藏其他列表的方法,涉及jquery鼠标事件及节点的遍历与属性操作技巧,具有一定参考借鉴价值,需要的朋友可以参考下 本文实例讲述了jquery实现点击 ...

  3. jQuery学习笔记(4)-设置元素的属性和样式

    一.前言 本篇主要讲解如何使用jQuery获取和操作元素的属性和css样式 二."DOM属性"与元素属性 1.运行一下代码 <img src="/images/lo ...

  4. jquery的toggle()函数,显示/隐藏交替

    <!DOCTYPE html> <html lang="en"> <head> <script src="jquery.js&q ...

  5. jQuery 点击显示再次点击隐藏

    <html> <head> <script type="text/javascript" src="/jquery/jquery.js&qu ...

  6. jquery实现点击页面其他地方隐藏指定元素

    代码实例如下: <!DOCTYPE html><html><head><meta charset=" utf-8"><meta ...

  7. JQuery判断div(控件)是否为隐藏

    以下是JavaScript 中判断div是否为隐藏代码引用片段: if (div.style.display == "none") { div.style.display = &q ...

  8. JQuery采纳CSS实现DOM显示和隐藏要素

    今天参加了Code Review活动.阅读编写代码的同事,感到满足当前功能的实现,但是从长远来看,,无论角度还是从代码重用是来看显然不佳维修点. 有什么需要看的权利.通过选择不同的选项下拉框需求,为了 ...

  9. jquery 点击页面其他地方实现隐藏菜单功能

    1.给页面文档添加一个点击事件函数,在函数内实现隐藏菜单功能. $('html').click(function(){//Hide the menus if visible});//用$(docume ...

随机推荐

  1. [Mugeda HTML5技术教程之11]Mugeda API简介

    一.API 概述 Mugeda API 提供了一个简单的,结构化的方法来实时动态管理Mugeda内容.它提供了一下方法: •访问Mugeda内容中的对象. •获取和设置对象属性,如位置.旋转.比例.不 ...

  2. dedecms _ 栏目无法更新

    dedecms 后台_  栏目无法更新: 那天我在移站,  出现了这个问题 例如这样的提示: 遇到问题咱就得解决啊: 解决方法如下: 进入dedecms后台 进入----系统-----系统基本参数-- ...

  3. 给大家推荐几款OSX上非常好工具(针对程序员)

    前两天,在App Store无意中发现几款免费工具,感觉非常好用,推荐给大家,希望大家喜欢. 一个是帮助文档管理软件,Dash.以前在Windows上开发,经常要自己搜集一些手册,文档,什么html手 ...

  4. C#文本文件导入数据库

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windo ...

  5. tensorflow 使用

    1.linux 安装tensorflow ubuntu中安装:link 用pip安装的过程中,可能出现网络链接的问题,尝试多次链接,直到成功!!! python -V sudo apt-get ins ...

  6. 错误日志类C#

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...

  7. ExtJS4.2.1

    ExtJS4.2.1 1. 介绍 1.1 说明 ExtJS是一个用javascript.CSS和HTML等技术实现的主要用于创建RIA即富客户端,且与后台技术无关的前端Ajax框架. 常用于企业内部管 ...

  8. Histogram Equalization

    转载请注明出处. Histogram Equalization 也就是直方图均衡化, 是一种常用的通过直方图处理来增强图像的方法. 对于一副灰度图像,其像素范围一般在0~255之间,我们记nk(0&l ...

  9. javascript 数组slice和splice

    var a = [1,4,2,5,6,9,10];console.log(a.slice(3)); //[5,6,9,10]console.log(a.slice(-3)); //[6,9,10]co ...

  10. LeetCode_Swap Nodes in Pairs

    Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2-& ...