Skip to content

Instantly share code, notes, and snippets.

@juliomenendez
Created February 8, 2013 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliomenendez/4742814 to your computer and use it in GitHub Desktop.
Save juliomenendez/4742814 to your computer and use it in GitHub Desktop.
Backbone.Marionette.Region extended to animate changing its content.
var AnimatedRegion = Backbone.Marionette.Region.extend({
show: function(view) {
var that = this;
this.ensureEl();
this.close();
view.on('close', function() {
that.$el.addClass('transparent'); });
$.when(view.render()).then(function() {
that.open(view);
that.$el.removeClass('transparent');
Marionette.triggerMethod.call(view, "show");
Marionette.triggerMethod.call(that, "show", view);
});
this.currentView = view;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment