Last active
August 29, 2015 14:16
-
-
Save DannyDelott/12f62f148a1ec8dd15f9 to your computer and use it in GitHub Desktop.
A basic View object in Backbone.js
This file contains 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 CubeView = Backbone.View.extend({ | |
// The reference to the DOM element. | |
el: '#cube', | |
// What to do when a CubeView is instantiated. | |
initialize: function(){ | |
this.render(); | |
}, | |
// The function responsible for making changes to the DOM element. | |
render: function(){ | |
$(this.el).fadeToggle(); | |
} | |
}); | |
// Instantiates a new CubeView. | |
var cube = new CubeView(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment