Vulcan/client/views/nav/mobile_nav.js

29 lines
759 B
JavaScript
Raw Normal View History

2014-07-09 09:46:24 +09:00
Template[getTemplate('mobile_nav')].helpers({
primaryNav: function () {
2015-03-12 18:15:59 +09:00
return _.sortBy(primaryNav, 'order');
},
secondaryNav: function () {
2015-03-12 18:15:59 +09:00
return _.sortBy(secondaryNav, 'order');
2014-07-09 09:46:24 +09:00
},
2014-08-13 17:34:56 +09:00
getTemplate: function () {
2015-03-10 11:50:21 +09:00
return getTemplate(this.template);
2014-07-09 09:46:24 +09:00
}
});
2014-07-05 11:24:28 +09:00
Template[getTemplate('mobile_nav')].events({
'click .dropdown-sub-level': function () {
2012-12-05 11:05:05 +09:00
$('body').toggleClass('mobile-nav-open');
}
2014-07-10 11:45:34 +09:00
});
Template[getTemplate('mobile_nav')].events({
2014-08-12 17:11:36 +09:00
'click .dropdown-top-level': function (e) {
2014-07-10 11:45:34 +09:00
e.preventDefault();
$(e.currentTarget).next().slideToggle('fast');
2014-08-12 17:11:36 +09:00
},
'click .mobile-nav a': function (e) {
if (e.target.className.indexOf('dropdown-top-level') == -1){
$('body').removeClass('mobile-nav-open');
}
2014-07-10 11:45:34 +09:00
}
});