PageSourceSearch

https://www.iisc.ac.in/wp-content/themes/iisc/js/menu-script.js

js iisc.ac.in collected 2026-09-24 08:36:13 UTC 3,298 bytes, 220 lines download raw bytes

1(function($) {
2
3
4
5  $.fn.menumaker = function(options) {
6
7      
8
9      var cssmenu = $(this), settings = $.extend({
10
11        title: "Menu",
12
13        format: "multitoggle",
14
15        sticky: false
16
17      }, options);
18
19
20
21      return this.each(function() {
22
23        cssmenu.prepend('<div id="menu-button">' + settings.title + '</div>');
24
25        $(this).find("#menu-button").on('click', function(){
26
27          $(this).toggleClass('menu-opened');
28
29          var mainmenu = $(this).next('ul');
30
31          if (mainmenu.hasClass('open')) { 
32
33            mainmenu.hide().removeClass('open');
34
35          }
36
37          else {
38
39            mainmenu.show().addClass('open');
40
41            if (settings.format === "dropdown") {
42
43              mainmenu.find('ul').show();
44
45            }
46
47          }
48
49        });
50
51
52
53        cssmenu.find('li ul').parent().addClass('has-sub');
54
55
56
57        multiTg = function() {
58
59          cssmenu.find(".has-sub").prepend('<span class="submenu-button"></span>');
60
61          cssmenu.find('.submenu-button').on('click', function() {
62
63            $(this).toggleClass('submenu-opened');
64
65            if ($(this).siblings('ul').hasClass('open')) {
66
67              $(this).siblings('ul').removeClass('open').hide();
68
69            }
70
71            else {
72
73              $(this).siblings('ul').addClass('open').show();
74
75            }
76
77          });
78
79        };
80
81
82
83        if (settings.format === 'multitoggle') multiTg();
84
85        else cssmenu.addClass('dropdown');
86
87
88
89        if (settings.sticky === true) cssmenu.css('position', 'fixed');
90
91
92
93        resizeFix = function() {
94
95          if ($( window ).width() > 922) {
96
97            cssmenu.find('ul').show();
98
99          }
100
101
102
103          if ($(window).width() <= 922) {
104
105            cssmenu.find('ul').hide().removeClass('open');
106
107          }
108
109        };
110
111        resizeFix();
112
113        return $(window).on('resize', resizeFix);
114
115
116
117      });
118
119  };
120
121})(jQuery);
122
123
124
125(function($){
126
127$(document).ready(function(){
128
129
130
131$(document).ready(function() {
132
133  $("#cssmenu").menumaker({
134
135    title: "Menu",
136
137    format: "multitoggle"
138
139  });
140
141
142
143  $("#cssmenu").prepend("<div id='menu-line'></div>");
144
145
146
147var foundActive = false, activeElement, linePosition = 0, menuLine = $("#cssmenu #menu-line"), lineWidth, defaultPosition, defaultWidth;
148
149
150
151$("#cssmenu > ul > li").each(function() {
152
153  if ($(this).hasClass('active')) {
154
155    activeElement = $(this);
156
157    foundActive = true;
158
159  }
160
161});
162
163
164
165if (foundActive === false) {
166
167  activeElement = $("#cssmenu > ul > li").first();
168
169}
170
171
172
173defaultWidth = lineWidth = activeElement.width();
174
175
176
177defaultPosition = linePosition = activeElement.position().left;
178
179
180
181menuLine.css("width", lineWidth);
182
183menuLine.css("left", linePosition);
184
185
186
187$("#cssmenu > ul > li").hover(function() {
188
189  activeElement = $(this);
190
191  lineWidth = activeElement.width();
192
193  linePosition = activeElement.position().left;
194
195  menuLine.css("width", lineWidth);
196
197  menuLine.css("left", linePosition);
198
199}, 
200
201function() {
202
203  menuLine.css("left", defaultPosition);
204
205  menuLine.css("width", defaultWidth);
206
207});
208
209
210
211});
212
213
214
215
216
217});
218
219})(jQuery);
220

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.