Created
May 12, 2010 20:42
-
-
Save quirkey/399098 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
$.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