随笔分类 -  jQuery

jQuery学习笔记
摘要:段落不够清晰,待整理看jQuery源码的时候,经常见到含有hooks标志的对象,如cssHooks, attrHooks, propHooks, valHooks.下面对其中的一段进行解读。jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed... 阅读全文
posted @ 2013-07-01 15:17 zzu-han 阅读(627) 评论(0) 推荐(0)
摘要:DeferredCallbacks 阅读全文
posted @ 2013-02-22 11:19 zzu-han 阅读(229) 评论(0) 推荐(1)
摘要:一:选择器指定具体选择器缓存选择器$('.class').each(function(){ $(this).html(); $(this).find('div').each(function(){ });});// 优化$('.class').each(function(){ var $this = $(this); $this.html(); $this.find('div').each(function(){ });}); 二: 阅读全文
posted @ 2013-02-21 16:33 zzu-han 阅读(262) 评论(0) 推荐(1)
摘要:如题 作为下来的计划 阅读全文
posted @ 2013-02-20 14:15 zzu-han 阅读(290) 评论(0) 推荐(0)
摘要:实例:操作一个ul列表,添加点击事件1 $('.list')2 .find('.list-item').click(function(){...}).end()3 .click(function(){...});这段函数用到了end,将对象转换成了find操作之前的$('.list')的jquery父对象。end函数1 end: function() {2 return this.prevObject || this.constructor(null);3 },重点 this.prevObject,find中调用了pushStackfind函数/ 阅读全文
posted @ 2013-02-20 14:14 zzu-han 阅读(2101) 评论(2) 推荐(1)
摘要:1 '',null,undefined转换为bool类型时都为false//'handle '',undefined and null' 0也会转换为false,但一般不会输入0if (selector) { return;} 2 根据对象的属性判断是否为你所要的对象// 根据是否有nodeType属性判断为DOM对象if ( selector.nodeType ) { this[0] = selector; this.length = 1; this.context = selector; return this;} 3 阅读全文
posted @ 2012-08-17 22:03 zzu-han 阅读(157) 评论(0) 推荐(0)
摘要:添加元素var $required = $('<strong class="high">*</strong>');$(this).parent().append($required);$(this).parent().append('<strong class="high">*</strong>'); //也可以这样 选择器:$('[name=items]:checkbox') 选择name为items的checkbox框。当然也可以反过来.$('[n 阅读全文
posted @ 2012-08-16 10:31 zzu-han 阅读(464) 评论(0) 推荐(0)