Created
November 10, 2013 18:55
-
-
Save felipap/7402240 to your computer and use it in GitHub Desktop.
The basic object I use to inherit most of my views in vempraruavem.org from.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var DefaultView = Backbone.View.extend({ | |
btn: $("<div>"), | |
constructor: function () { | |
var self = this; | |
this.btn.click(function () { self.toggle(); }); | |
Backbone.View.apply(this, arguments); | |
this.$el.on('click', '[data-action=exit]', function () { self.hide(); }) | |
}, | |
show: function () { | |
this.$el.fadeIn(); | |
this.btn.addClass('active'); | |
var self = this; | |
}, | |
hide: function () { | |
this.$el.fadeOut(); | |
this.btn.removeClass('active'); | |
}, | |
toggle: function () { | |
this.$el.fadeToggle(); | |
this.btn.toggleClass('active'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment