-
Notifications
You must be signed in to change notification settings - Fork 2
/
simpleMobileMenu.js
executable file
·57 lines (45 loc) · 1.49 KB
/
simpleMobileMenu.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
(function ( $ ) {
$.fn.smplmnu = function(options) {
//settings
var settings = $.extend({
// These are the defaults.
background: "#000",
speed: "0.5s",
textColor: "#fff"
}, options );
//vars
var hittrigger = $(this);
var clspos = hittrigger.next('ul');
var menutextcolor = hittrigger.next('ul li a');
var overllay = '<div class="overally"></div>';
//manipulating dom
hittrigger.addClass('inrwrpr');
clspos.addClass('inrwrpr');
$('.inrwrpr').wrapAll( "<div class='navwrp'>" );
clspos.prepend('<a href="javascript:void(0)" class="mnuclose ion-close-round"><span>X</span></a>');
$('body').prepend(overllay);
//functions and methods
hittrigger.click(function(event){
hittrigger.next('ul').addClass('mobimenu');
$('.mobimenu').addClass('mnuopn');
$('.mnuopn').css({
'z-index': '9999',
'background-color': settings.background,
'transition': settings.speed
});
$('.mnuopn a').css({
'color': settings.textColor
});
$('.overally').addClass('ovrActv');
});
$('.mnuclose').click(function(event) {
hittrigger.next('ul').removeClass('mnuopn');
$('.overally').removeClass('ovrActv');
});
$('.overally').click(function(event) {
clspos.removeClass('mnuopn');
$(this).removeClass('ovrActv')
});
return this
};
}( jQuery ));