Ghost/ghost/admin/views/application.js
Matt Enlow 1089cdb036 Fix mobile sidebar menu
Closes #3110
- Created `ApplicationView`
- Added `js-close-sidebar` classes to navbar navigation links
- Clicking on a navigation link in the sidebar will close it
2014-07-07 08:55:22 -06:00

21 lines
663 B
JavaScript

import {responsiveAction} from 'ghost/utils/mobile-utils';
var ApplicationView = Ember.View.extend({
mobileInteractions: function () {
var body = $('body');
// ### Toggle the mobile sidebar menu
$('[data-off-canvas]').on('click', function (event) {
responsiveAction(event, '(max-width: 650px)', function () {
body.toggleClass('off-canvas');
});
});
// #### Navigating within the sidebar closes it.
$('.js-close-sidebar').on('click', function () {
body.removeClass('off-canvas');
});
}.on('didInsertElement')
});
export default ApplicationView;