jquery 1.9里面已经删除了toggle(fn1, fn2)函数:
引用
Note: This method signature was deprecated in jQuery 1.8 and removed in jQuery 
1.9. jQuery also provides an animation method named .toggle() that toggles the 
visibility of elements. Whether the animation or the event method is fired depends on 
the set of arguments passed.

要用的话可以引用1.9以下的jquery,或者写一个替代

var flag=1;
    $(".selector").click(function(){
        if(flag==1){
            //执行方法;
            flag=0;
        }else{
            //执行方法;
            flag=1;
        }

或者外接函数,例如

toggle(objs) {
    $(objs).each(function(){
        if ($(this).is(':hidden')) $(this).show(); else $(this).hide();
    });
}

jquery 1.9里面已经删除了toggle(fn1, fn2)函数:的更多相关文章

  1. jquery 1.9里面已经删除了toggle(fn1, fn2)函数

    转自:http://blog.sina.com.cn/s/blog_50042fab0101c7a9.html jquery 1.9里面已经删除了toggle(fn1, fn2)函数: 引用 Note ...

  2. ThinkPHP第二十一天(JQuery元素获取,parents属性,toggle方法,确认弹出对话框使用)

    1.JQuery用法 A:$(function(){code...});表示当页面载入完毕后执行 B:获取元素方法:根据class名称 $('.classname'),根据ID名称 $('#IDnam ...

  3. JQuery获取元素宽度.width()与.css(‘width’)两个函数的区别

    整理翻译自:http://blog.jquery.com/2012/08/16/jquery-1-8-box-sizing-width-csswidth-and-outerwidth/ 大意是: 在J ...

  4. jQuery元素属性attr设置多个键值或函数 删除属性removeAttr

    $("Element").attr(name) '取得第一个匹配的属性值,比如$("img").attr("src") $("El ...

  5. jQuery 源码解析(八) 异步队列模块 Callbacks 回调函数详解

    异步队列用于实现异步任务和回调函数的解耦,为ajax模块.队列模块.ready事件提供基础功能,包含三个部分:Query.Callbacks(flags).jQuery.Deferred(funct) ...

  6. jquery 1.9以上新版本不支持toggle()的解决方法

    原文:http://blog.csdn.net/u011061889/article/details/50397462 参考: http://www.cnblogs.com/lionden/archi ...

  7. 关于jQuery中toggle参数callback函数提前执行问题

    通过 jQuery,您可以使用 toggle() 方法来切换 hide() 和 show() 方法. 显示被隐藏的元素,并隐藏已显示的元素: $(selector).toggle(speed,call ...

  8. jQuery 2.0.3 源码分析Sizzle引擎 - 编译函数(大篇幅)

    声明:本文为原创文章,如需转载,请注明来源并保留原文链接Aaron,谢谢! 从Sizzle1.8开始,这是Sizzle的分界线了,引入了编译函数机制 网上基本没有资料细说这个东东的,sizzle引入这 ...

  9. jQuery数组($.each,$.grep,$.map,$.merge,$.inArray,$.unique,$.makeArray)处理函数详解

    1. $.each(array, [callback]) 遍历[常用] 解释: 不同于例遍jQuery对象的$().each()方法,此方法可用于例遍任何对象.回调函数拥有两个参数:第一个为对象的成员 ...

随机推荐

  1. Spring+Mybatis+Dubbo报错java.lang.reflect.MalformedParameterizedTypeException

    原因是spring的jar文件冲突,排除spring的文件即可 <dependency> <groupId>com.alibaba</groupId> <ar ...

  2. CF1083B The Fair Nut and String

    题意 给出两个长度为n的01字符串S和T. 选出k个字典序在S和T之间的长度为n的01字符串,使得尽可能多的字符串满足其是所选字符串中至少一个串的前缀. 这是一道思路比较奇怪的类似计数dp的题. 首先 ...

  3. configparser、subprocess模块

    一.configparser模块 该模块适用于配置文件的格式与windows ini文件类似,可以包含一个或多个节(section),每个节可以有多个参数(键=值). 1.创建文件 一般软件的常见文档 ...

  4. Hash索引和BTree索引

    索引是帮助mysql获取数据的数据结构.最常见的索引是Btree索引和Hash索引. 不同的引擎对于索引有不同的支持:Innodb和MyISAM默认的索引是Btree索引:而Mermory默认的索引是 ...

  5. Filesystem has been set read-only problem.

    case: when system is running well ,sudden tf became read-only; analyze: read the kernel log using dm ...

  6. learning uboot support web http function in qca4531 cpu

    reference :https://forum.openwrt.org/viewtopic.php?id=43237 reference :http://blog.chinaunix.net/uid ...

  7. POJ 2289 Jamie's Contact Groups 二分图多重匹配 难度:1

    Jamie's Contact Groups Time Limit: 7000MS   Memory Limit: 65536K Total Submissions: 6511   Accepted: ...

  8. 自己写的一个delphi正整数快速排序

    type   TIntArr= array of word; procedure MyQSort(var arr: TIntArr; low: word; high: word); //word可以改 ...

  9. MyEclipse持续性开发教程:用JPA和Spring管理数据(二)

    MyEclipse红运年货节 在线购买低至69折!火爆开抢>> [MyEclipse最新版下载] 本教程介绍了MyEclipse中的一些基于JPA / Spring的功能.有关设置JPA项 ...

  10. DevExpress v17.2新版亮点—WPF篇(二)

    用户界面套包DevExpress v17.2终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了DevExpress WPF v17.2 新的Hamburger Menu.Sched ...