摘要: 缓存变量 DOM遍历是昂贵的,所以尽量将会重用的元素缓存。 1 // 糟糕 2 h = $('#element').height(); 3 $('#element').css('height',h-20); 4 5 // 建议 6 $element = $('#element'); 7 h = $e 阅读全文
posted @ 2017-02-22 10:34 刚二代 阅读(428) 评论(0) 推荐(0) 编辑