Skip to content

Instantly share code, notes, and snippets.

@DannyDelott
Last active August 29, 2015 14:16
Show Gist options
  • Save DannyDelott/12f62f148a1ec8dd15f9 to your computer and use it in GitHub Desktop.
Save DannyDelott/12f62f148a1ec8dd15f9 to your computer and use it in GitHub Desktop.
A basic View object in Backbone.js
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