Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
134 lines (107 sloc) 4.04 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
<title>Wizard modal</title>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<!-- Adding Backbone.Modal extension here -->
<link type="text/css" rel="stylesheet" href="/backbone.modal.css">
<link type="text/css" rel="stylesheet" href="/backbone.modal.theme.css">
<script type="text/javascript" src="/backbone.modal.js"></script>
<!-- Custom style -->
<link type="text/css" rel="stylesheet" href="/examples/css/style.css">
</head>
<body>
<a href="#" class="open">Open modal</a>
<div class="app"></div>
<!-- The modal structure, with an container element that will contain all tabs -->
<script type="text/template" id="modal-template">
<div class="my-container"></div>
</script>
<!-- Step 1 -->
<script type="text/template" id="modal-view1-template">
<div class="bbm-modal__topbar">
<h3 class="bbm-modal__title">Wizard example - step 1</h3>
</div>
<div class="bbm-modal__section">
<p>You can create all kinds of modals, like this wizard. It's pretty basic, but you can do anything you'd like.</p>
<a href="#" id="step3">Directly go to the last step</a>
</div>
<div class="bbm-modal__bottombar">
<a href="#" class="bbm-button previous inactive">Previous</a>
<a href="#" class="bbm-button next">Next</a>
</div>
</script>
<!-- Step 2 -->
<script type="text/template" id="modal-view2-template">
<div class="bbm-modal__topbar">
<h3 class="bbm-modal__title">Wizard example - step 2</h3>
</div>
<div class="bbm-modal__section">
<p>This is the second step of the wizard.</p>
</div>
<div class="bbm-modal__bottombar">
<a href="#" class="bbm-button previous">Previous</a>
<a href="#" class="bbm-button next">Next</a>
</div>
</script>
<!-- Step 3 -->
<script type="text/template" id="modal-view3-template">
<div class="bbm-modal__topbar">
<h3 class="bbm-modal__title">Wizard example - step 3</h3>
</div>
<div class="bbm-modal__section">
<p>And finally, the last step!</p>
</div>
<div class="bbm-modal__bottombar">
<a href="#" class="bbm-button previous">Previous</a>
<a href="#" class="bbm-button done">Done</a>
</div>
</script>
<script>
jQuery(function($) {
// Create a modal view class
var Modal = Backbone.Modal.extend({
template: _.template($('#modal-template').html()),
viewContainer: '.my-container',
submitEl: '.done',
cancelEl: '.cancel',
views: {
'click #step1': {
view: _.template($('#modal-view1-template').html())
},
'click #step2': {
view: _.template($('#modal-view2-template').html())
},
'click #step3': {
view: _.template($('#modal-view3-template').html())
}
},
events: {
'click .previous': 'previousStep',
'click .next': 'nextStep'
},
previousStep: function(e) {
e.preventDefault();
this.previous();
},
nextStep: function(e) {
e.preventDefault();
this.next();
}
});
$('.open').on('click', function(){
// Render an instance of your modal
var modalView = new Modal();
$('.app').html(modalView.render().el);
});
$('.open').click()
});
</script>
<!-- Do not include in your page -->
<script src="//localhost:35729/livereload.js"></script>
</body>
</html>