Skip to content

Instantly share code, notes, and snippets.

@quirkey
Created May 12, 2010 20:42
Show Gist options
  • Save quirkey/399098 to your computer and use it in GitHub Desktop.
Save quirkey/399098 to your computer and use it in GitHub Desktop.
$.sammy(function() {
this.helpers({
showModal: function() {
$('.modal').show('slow');
},
hideModal: function() {
$('.modal').show('slow');
}
});
this.before(function() {
// always hide the modal if we're switching routes
this.hideModal();
})
this.get('#/', function() {
this.partial('main.template');
});
this.bind('show-modal', function() {
// also do whatever else you want here
this.showModal();
});
this.bind('run', function() {
var context = this;
// open modal button
$('a[data-show-modal]').live('click', function() {
context.trigger('show-modal');
});
// close button
$('a[data-hide-modal]').live('click', function() {
context.hideModal();
});
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment