-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
executable file
·73 lines (67 loc) · 1.97 KB
/
script.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
$(document).ready(function() {
$("#slider").responsiveSlides({
auto: true,
nav: true,
speed: 500,
namespace: "slides",
pager: false
});
$(".menu").menu();
});
$.fn.menu = function(e) {
function r() {
$(".menu").find("li, a").unbind();
if (window.innerWidth <= 768) {
o();
s();
if (n == 0) {
$(".menu > li:not(.showhide)").hide(0)
}
} else {
u();
i()
}
}
function i() {
$(".menu li").bind("mouseover", function() {
$(this).children(".dropdown, .menu-panel").stop().fadeIn(t.interval)
}).bind("mouseleave", function() {
$(this).children(".dropdown, .menu-panel").stop().fadeOut(t.interval)
})
}
function s() {
$(".menu > li > a").bind("click", function(e) {
if ($(this).siblings(".dropdown, .menu-panel").css("display") == "none") {
$(this).siblings(".dropdown, .menu-panel").slideDown(t.interval);
$(this).siblings(".dropdown").find("ul").slideDown(t.interval);
n = 1
} else {
$(this).siblings(".dropdown, .menu-panel").slideUp(t.interval)
}
})
}
function o() {
$(".menu > li.showhide").show(0);
$(".menu > li.showhide").bind("click", function() {
if ($(".menu > li").is(":hidden")) {
$(".menu > li").slideDown(300)
} else {
$(".menu > li:not(.showhide)").slideUp(300);
$(".menu > li.showhide").show(0)
}
})
}
function u() {
$(".menu > li").show(0);
$(".menu > li.showhide").hide(0)
}
var t = {
interval: 250
};
var n = 0;
$(".menu").prepend("<li class='showhide'><span class='title'>MENU</span><span class='icon1'></span><span class='icon2'></span></li>");
r();
$(window).resize(function() {
r()
})
}