-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathscript.js
More file actions
40 lines (33 loc) · 1.21 KB
/
script.js
File metadata and controls
40 lines (33 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
(function($) {
$(document).ready(function() {
// *************************************************
// Initialize Foundation
// *************************************************
if(typeof $.prototype.foundation === 'function') {
$(document).foundation();
}
// *************************************************
// Global navigation
// *************************************************
var globalNav = {
init: function() {
// toggle global navigation
var $toggleBtn = $('.gnav__trigger');
var $toggledMenu = $('.gnav__list');
$toggleBtn.on('click', function(e) {
e.preventDefault();
$toggleBtn.toggleClass('gnav__list--active');
$toggledMenu.toggleClass('gnav__list--active');
});
// add button that display child menu items
$('#gnav-list').find('.menu-item-has-children > a').after('<button class="gnav__arrowdown"></button>');
// toggle submenu items.
var $dropDownToggle = $('.gnav__arrowdown');
$dropDownToggle.on('click', function(e) {
$(this).siblings('.sub-menu').slideToggle();
});
}
};
globalNav.init();
});
})(jQuery);