This repository was archived by the owner on Jun 3, 2024. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
124 lines (106 loc) · 3.67 KB
/
Copy pathscript.js
File metadata and controls
124 lines (106 loc) · 3.67 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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
(function($) {
$.fn.menumaker = function(options) {
var cssmenu = $(this), settings = $.extend({
title: "Menu",
format: "dropdown",
breakpoint: 768,
sticky: false,
reset: 1000
}, options);
return this.each(function() {
cssmenu.find('li ul').parent().addClass('has-sub');
/*
if (settings.format != 'select') {
cssmenu.prepend('<div id="menu-button">' + settings.title + '</div>');
$(this).find("#menu-button").on('mouseover', function(){
$(this).toggleClass('menu-opened');
var mainmenu = $(this).next('ul');
if (mainmenu.hasClass('open')) {
mainmenu.hide().removeClass('open');
}
else {
mainmenu.show().addClass('open');
if (settings.format === "dropdown") {
mainmenu.find('ul').show();
}
}
});
multiTg = function() {
cssmenu.find(".has-sub").prepend('<span class="submenu-button"></span>');
cssmenu.find('.submenu-button').hover(function() {
$(this).toggleClass('submenu-opened');
if ($(this).siblings('ul').hasClass('open')) {
$(this).siblings('ul').removeClass('open').hide();
}
else {
$(this).siblings('ul').addClass('open').show();
}
});
};
if (settings.format === 'multitoggle') multiTg();
else cssmenu.addClass('dropdown');
}*/
if (settings.format === 'select')
{
cssmenu.append('<select style="width: 100%"/>').addClass('select-list');
var selectList = cssmenu.find('select');
selectList.append('<option>' + settings.title + '</option>', {
"selected": "selected",
"value": ""});
cssmenu.find('a').each(function() {
var element = $(this), indentation = "";
for (i = 1; i < element.parents('ul').length; i++)
{
indentation += '-';
}
selectList.append('<option value="' + $(this).attr('href') + '">' + indentation + element.text() + '</option');
});
selectList.on('change', function() {
window.location = $(this).find("option:selected").val();
});
}
});
};
})(jQuery);
(function($){
$(document).ready(function(){
$(window).load(function() {
$("#cssmenu").menumaker({
title: "Menu",
format: "multitoggle"
});
$('#cssmenu').prepend("<div id='menu-indicator'></div>");
var foundActive = false,
activeElement,
indicatorPosition,
indicator = $('#cssmenu #menu-indicator'),
defaultPosition,
reset;
$("#cssmenu > ul > li").each(function() {
if ($(this).hasClass('active')) {
activeElement = $(this);
foundActive = true;
}
});
if (foundActive === false) {
activeElement = $("#cssmenu > ul > li").first();
}
defaultPosition = indicatorPosition = activeElement.position().top + activeElement.height()/2;
console.log(activeElement);
console.log(activeElement.position().top);
console.log(activeElement.height());
indicator.css("top", indicatorPosition);
$("#cssmenu > ul > li").hover(function() {
clearTimeout(reset);
activeElement = $(this);
indicatorPosition = activeElement.position().top + activeElement.height()/2 + 25;
indicator.css("top", indicatorPosition);
},
function() {
reset = setTimeout( function() {
indicator.css("top", defaultPosition)
}, 300 );
});
});
});
})(jQuery);