Last active
December 17, 2015 04:19
-
-
Save davidvanleeuwen/5550096 to your computer and use it in GitHub Desktop.
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
jQuery(function($) { | |
// create a layout class | |
var Layout = Backbone.Marionette.Layout.extend({ | |
template: _.template($('#modals-template').html()), | |
regions: { | |
modals: { | |
selector: '.modals-container', | |
regionClass: Backbone.Marionette.Modals | |
} | |
} | |
}); | |
// create a modal view class | |
var Modal = Backbone.Modal.extend({ | |
template: _.template($('#modal-template').html()), | |
viewContainer: '.modal-view', | |
views: { | |
'click #first': { | |
view: _.template($('#modal-view1-template').html()) | |
}, | |
'click #second': { | |
view: _.template($('#modal-view2-template').html()) | |
} | |
} | |
}); | |
var myLayout = new Layout(); | |
$('body').append(myLayout.render().el); | |
myLayout.modals.show(new Modal()); | |
myLayout.modals.show(new Modal()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment