forked from wp-premium/gravityforms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.js
39 lines (37 loc) · 1.36 KB
/
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
/*
Copyright 2008 by Marco van Hylckama Vlieg
web: http://www.i-marco.nl/weblog/
email: marco@i-marco.nl
Free for use
*/
function initMenus() {
jQuery('ul.menu ul').hide();
jQuery.each(jQuery('ul.menu'), function(){
jQuery('#' + this.id + '.expandfirst ul:first').show();
});
jQuery('ul.menu li .button-title-link').click(
function() {
var checkElement = jQuery(this).next();
var parent = this.parentNode.parentNode.id;
if(jQuery('#' + parent).hasClass('noaccordion')) {
jQuery(this).next().slideToggle('normal');
return false;
}
if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
if(jQuery('#' + parent).hasClass('collapsible')) {
jQuery('#' + parent + ' ul:visible').slideUp('normal', function(){jQuery(this).prev().removeClass('gf_button_title_active')});
}
return false;
}
if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
jQuery('#' + parent + ' ul:visible').slideUp('normal', function(){jQuery(this).prev().removeClass('gf_button_title_active')});
checkElement.slideDown('normal', function(){jQuery(this).prev().addClass('gf_button_title_active')});
return false;
}
}
);
}
jQuery(document).ready(function() {initMenus();});
jQuery(document).ready(function() {
jQuery('div.add-buttons-title').append('<span class="add-buttons-caret-down"><i class="fa fa-caret-down"></i></span>');
});