0
嗨,我想切换两个div。我做了基本的方法,但我真的想这样写,我不知道这有什么问题。有人可以帮我吗?切换两个div查询
(function($) {
var showAll = function() {
this.$button = this.find('.btn-all-events');
this.$all = this.find('.all-events');
this.$recent = this.find('.recent-events');
this.initEvents();
};
showAll.prototype = {
initEvents: function() {
if (this.$all) {
this.$button.on('click', this.showEvents.bind(this));
}
},
showEvents: function() {
this.$recent.hide();
this.$all.show();
}
};
this.toggle = new showAll($(this));
})(jQuery);
我在VAR代替这一点,仍然没有对我来说不是作品 –