-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgrt-responsive-menu.js
40 lines (35 loc) · 948 Bytes
/
grt-responsive-menu.js
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
39
40
/*!
* GRT Responsive Menu - jQuery Plugin
* Version: 1.1
* Author: GRT107
*
* Copyright (c) 2018 GRT107
* Released under the MIT license
*/
// Create a function for mobile version
(function( $ ){
$.fn.grtmobile = function () {
$('.grt-mobile-button').on('click', function(){
$(this).toggleClass("grt-mobile-button-open");
$("ul.grt-menu").toggleClass("open-grt-menu ");
$("html, body").toggleClass("body-overflow");
});
$('li.grt-dropdown').on('click', function(e){
$(this).toggleClass("active-dropdown");
});
}
})( jQuery );
// Initialize and check for mobile
$.fn.grtmobile();
// Add fixed class on scroll after 60px
$(window).scroll(function(e){
if ($(this).scrollTop() > 60){
$('header').addClass('scrolled');
} else {
$('header').removeClass('scrolled');
}
});
// Prevent a href clicks on dropdown category item
$('li.grt-dropdown > a').on('click', function(e){
e.preventDefault();
});