jQuery的hide
方法执行
for (i = 0; i < j; i++) {
this[i].style.display = "none";
}
你有一些其他的问题。
完整的方法是
hide: function(speed, easing, callback) {
if (speed || speed === 0) {
return this.animate(genFx("hide", 3), speed, easing, callback);
} else {
for (var i = 0, j = this.length; i < j; i++) {
var display = jQuery.css(this[i], "display");
if (display !== "none") {
jQuery.data(this[i], "olddisplay", display);
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for (i = 0; i < j; i++) {
this[i].style.display = "none";
}
return this;
}
},
绝对正确......有另一种方法嵌套在那里'缓存'显示属性。谢谢! – 2011-01-06 20:23:14