使用jQuery show() 功能完整无动画

Use jQuery show() with complete function and no animation

这个问题是 jQuery toggle() with no animation...

的补充

为了避免在元素的 show 上出现动画,我尝试替换以下 2 行

var that = this;
this.$el.show("fast", null, function(){that.updatePosition()});

以下,

this.$el.show();    
this.updatePosition();

是否有可能在当前元素变为visible之前调用函数updatePosition?如果是,那么我应该尽量避免动画的解决方法是什么。

您可以将持续时间作为 0 作为 jQueryElement.show 中的第一个参数传递。 callback 函数将在 0 持续时间后调用。

$(this).show(0, function() {
  //callback function
});