您好,登录后才能下订单哦!
  例如执行: $({}).bind('cust', function(){});
 结果:  TypeError: Object has no method 'addEventListener'
  解决办法是创建一个脱离文档流的节点作为事件对象:
例如: $('').bind('cust', function(){});
  例如执行:$('[data-userid=123123123]')
         结果:Error: SyntaxError: DOM Exception 12
解决办法: $('[data-userid="123123123]"') or $("[data-userid='123123123']")
    应该使用$('option').not(function(){ return !this.selected })
    比如:jq:$this.find('option[selected]').attr('data-v') * 1
 zepto:$this.find('option').not(function() {return !this.selected}).attr('data-v') * 1
   但是获取有select中含有disabled属性的元素可以用 $this.find("option:not(:disabled)") 因为disabled是标准属性
参考网址:https://github.com/madrobby/zepto/issues/503
3.Zepto 是根据标准浏览器写的,所以对于节点尺寸的方法只提供 width() 和 height(),省去了 innerWidth(), innerHeight(),outerWidth(),outerHeight()
Zepto.js: 由盒模型( box-sizing )决定
jQery: 忽略盒模型,始终返回内容区域的宽/高(不包含 padding 、 border )解决方式就是使用 .css('width') 而不是 .width() 。
假设用下面的 HTML 和 CSS 画了一个小三角形:
| 1 2 3 4 5 6 7 8 | <divclass="caret">.caret { }  | 
jQuery 使用 .width() 和 .css('width') 都返回 ,高度也一样;
Zepto 使用 .width() 返回 ,使用 .css('width') 返回 0px 。
所以,这种场景,jQuery 使用 .outerWidth() / .outerHeight() ;Zepto 使用 .width() / .height() 。
Zepto.js: 返回 top 、 left 、 width 、 height
jQuery: 返回 width 、 height
Zepto.js: 无法获取宽高;
jQuery: 可以获取。
| 1 2 3 4 5 | $("#some_element").animate({         opacity: 0.25, left: '50px',         color: '#abcdef',         rotateZ: '45deg', translate3d: '0,10px,0'         }, 500, 'ease-out')<prename="code" class="html">  | 
| 1 2 3 4 | $this_bd.animate({height:iTthis_bd_h+'px',complete:siblingsUp()},700);         function siblingsUp(){             $this_bd.siblings('.bd').animate({height:'0px'},50);         }; | 
会发现zepto的complete会先执行,在执行animate动画,所以 回调函数应该写在后面,如
$('.warter').animate({margin:'150px 0 0 -80px',opacity:'1',rotate:'-45deg'},800,'ease-in-out',function(){alert(1);});
jq代码:
| 1 2 3 4 5 6 7 8 | (function($) {   $(function() {     var $list = $('<ul><li>jQuery 插入})(window.jQuery); | 
jQuery 操作 ul 上的 id 不会被添加。
zepto代码:
| 1 2 3 4 5 6 | Zepto(function($) {     var $list = $('<ul><li>Zepto 插入});  | 
Zepto 可以在 ul 上添加 id 。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。