我想为 jQuery 创建两个新方法,使对象出现和消失。我不想使用 jQuery 方法show()和hide()(既不是fadeIn()或fadeOut()),因为:
- 效果不是渐进的
- 当 a 时
divhides,该对象不再出现在页面中并且所有其他div移动。
我的代码不起作用:对象消失但不出现。
有什么线索吗?
jQuery.fn.disappear = function() {
this.fadeTo('slow', 0, function() {
this.css('visibility', 'hidden');
});
};
和
jQuery.fn.appear = function() {
this.css('visibility', 'visible');
this.fadeTo('slow', 1);
};