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代替這一點,仍然沒有對我來說不是作品 –