Skip to content

Instantly share code, notes, and snippets.

@mattd
Created November 25, 2013 22:44
Show Gist options
  • Save mattd/7650275 to your computer and use it in GitHub Desktop.
Save mattd/7650275 to your computer and use it in GitHub Desktop.
_.extend(FoundationHelper.prototype, {
initialize: function () {
_.bindAll(this, 'onModalOpened', 'onModalClosed');
this.runInitializers();
this.loadFoundation();
},
runInitializers: function () {
this.listenForModalOpen();
this.listenForModalClose();
},
loadFoundation: function () {
$(document).foundation({
reveal: {
animation: 'fade',
opened: this.onModalOpened,
closed: this.onModalClosed
},
topbar: {
is_hover: false,
custom_back_text: false
}
});
},
onModalOpened: function () {
var body = $('body');
body.addClass('modal-open');
if (body.hasClass('window')) {
state.vent.trigger('scroll:page', 0);
}
},
onModalClosed: function () {
var sizes = 'small medium full window';
this.modalRegion.currentView.close();
$('body').removeClass(sizes).removeClass('modal-open');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment