JQuery Accordion Menu Widget - Version 2.5

Version Description

  • Added: Auto-expand now independent of save state option
Download this release

Release Info

Developer remix4
Plugin Icon wp plugin JQuery Accordion Menu Widget
Version 2.5
Comparing to
See all releases

Code changes from version 2.4 to 2.5

dcwp_jquery_accordion.php CHANGED
@@ -5,7 +5,7 @@
5
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, accordion
6
Description: Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery. Features include - handles multiple levels, saved state using cookies and option of selecting "click" or "hover" events for triggering the menu.
7
Author: Lee Chestnutt
8
- Version: 2.4
9
Author URI: http://www.designchemical.com
10
*/
11
@@ -24,7 +24,7 @@ class dc_jqaccordion {
24
wp_enqueue_script( 'jquery' );
25
wp_enqueue_script( 'jqueryhoverintent', dc_jqaccordion::get_plugin_directory() . '/js/jquery.hoverIntent.minified.js', array('jquery') );
26
wp_enqueue_script( 'jquerycookie', dc_jqaccordion::get_plugin_directory() . '/js/jquery.cookie.js', array('jquery') );
27
- wp_enqueue_script( 'dcjqaccordion', dc_jqaccordion::get_plugin_directory() . '/js/jquery.dcjqaccordion.2.5.js', array('jquery') );
28
}
29
add_action( 'wp_footer', array('dc_jqaccordion', 'footer') );
30
5
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, accordion
6
Description: Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery. Features include - handles multiple levels, saved state using cookies and option of selecting "click" or "hover" events for triggering the menu.
7
Author: Lee Chestnutt
8
+ Version: 2.5
9
Author URI: http://www.designchemical.com
10
*/
11
24
wp_enqueue_script( 'jquery' );
25
wp_enqueue_script( 'jqueryhoverintent', dc_jqaccordion::get_plugin_directory() . '/js/jquery.hoverIntent.minified.js', array('jquery') );
26
wp_enqueue_script( 'jquerycookie', dc_jqaccordion::get_plugin_directory() . '/js/jquery.cookie.js', array('jquery') );
27
+ wp_enqueue_script( 'dcjqaccordion', dc_jqaccordion::get_plugin_directory() . '/js/jquery.dcjqaccordion.2.6.js', array('jquery') );
28
}
29
add_action( 'wp_footer', array('dc_jqaccordion', 'footer') );
30
js/{jquery.dcjqaccordion.2.5.js → jquery.dcjqaccordion.2.6.js} RENAMED
@@ -26,11 +26,14 @@
26
};
27
//call in the default otions
28
var options = $.extend(defaults, options);
29
- var $dcAccordionObj = this;
30
- return $dcAccordionObj.each(function(options){
31
setUpAccordion();
32
if(defaults.saveState == true){
33
- checkCookie(defaults.cookie, $dcAccordionObj);
34
}
35
resetAccordion();
36
if(defaults.eventType == 'hover'){
@@ -41,7 +44,7 @@
41
timeout: defaults.hoverDelay, // number = milliseconds delay before onMouseOut
42
out: linkOut // function = onMouseOut callback (REQUIRED)
43
};
44
- $('li a',$dcAccordionObj).hoverIntent(config);
45
var configMenu = {
46
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
47
interval: 1000, // number = milliseconds for onMouseOver polling interval
@@ -49,17 +52,17 @@
49
timeout: 1000, // number = milliseconds delay before onMouseOut
50
out: menuOut // function = onMouseOut callback (REQUIRED)
51
};
52
- $($dcAccordionObj).hoverIntent(configMenu);
53
// Disable parent links
54
if(defaults.disableLink == true){
55
- $('li a',$dcAccordionObj).click(function(e){
56
if($(this).siblings('ul').length >0){
57
e.preventDefault();
58
}
59
});
60
}
61
} else {
62
- $('li a',$dcAccordionObj).click(function(e){
63
$activeLi = $(this).parent('li');
64
$parentsLi = $activeLi.parents('li');
65
$parentsUl = $activeLi.parents('ul');
@@ -82,62 +85,79 @@
82
}
83
// Write cookie if save state is on
84
if(defaults.saveState == true){
85
- createCookie(defaults.cookie, $dcAccordionObj);
86
}
87
});
88
}
89
// Set up accordion
90
function setUpAccordion(){
91
$arrow = '<span class="'+defaults.classArrow+'"></span>';
92
- $('> ul',$dcAccordionObj).show();
93
- $('li',$dcAccordionObj).each(function(){
94
var classParentLi = defaults.classParent+'-li';
95
if($('> ul',this).length > 0){
96
$('> a',this).addClass(defaults.classParent).append($arrow);
97
}
98
});
99
- $('> ul',$dcAccordionObj).hide();
100
}
101
- });
102
- function linkOver(){
103
$activeLi = $(this).parent('li');
104
$parentsLi = $activeLi.parents('li');
105
- $parentsUl = $activeLi.parents('ul');
106
// Auto close sibling menus
107
if(defaults.autoClose == true){
108
- autoCloseAccordion($parentsLi, $parentsUl);
109
- }
110
if ($('> ul',$activeLi).is(':visible')){
111
$('ul',$activeLi).slideUp(defaults.speed);
112
$('a',$activeLi).removeClass(defaults.classActive);
113
} else {
114
$(this).siblings('ul').slideToggle(defaults.speed);
115
$('> a',$activeLi).addClass(defaults.classActive);
116
- }
117
// Write cookie if save state is on
118
if(defaults.saveState == true){
119
- createCookie(defaults.cookie, $dcAccordionObj);
120
}
121
- }
122
function linkOut(){
123
- }
124
function menuOver(){
125
- }
126
- function menuOut(){
127
if(defaults.menuClose == true){
128
- $('ul',$dcAccordionObj).slideUp(defaults.speed);
129
// Reset active links
130
- $('a',$dcAccordionObj).removeClass(defaults.classActive);
131
- createCookie(defaults.cookie, $dcAccordionObj);
132
}
133
- }
134
// Auto-Close Open Menu Items
135
function autoCloseAccordion($parentsLi, $parentsUl){
136
- $('ul',$dcAccordionObj).not($parentsUl).slideUp(defaults.speed);
137
// Reset active links
138
- $('a',$dcAccordionObj).removeClass(defaults.classActive);
139
$('> a',$parentsLi).addClass(defaults.classActive);
140
- }
141
// Retrieve cookie value and set active items
142
function checkCookie(cookieId, obj){
143
var cookieVal = $.cookie(cookieId);
@@ -151,15 +171,6 @@
151
$('> a',$parentsLi).addClass(defaults.classActive);
152
});
153
}
154
- if(defaults.autoExpand == true){
155
- $('li.'+defaults.classExpand+' > a').addClass(defaults.classActive);
156
- }
157
- }
158
- // Reset accordion using active links
159
- function resetAccordion(){
160
- $('ul',$dcAccordionObj).hide();
161
- $allActiveLi = $('a.'+defaults.classActive,$dcAccordionObj);
162
- $allActiveLi.siblings('ul').show();
163
}
164
// Write cookie
165
function createCookie(cookieId, obj){
26
};
27
//call in the default otions
28
var options = $.extend(defaults, options);
29
+ this.each(function(options){
30
+ var obj = this;
31
setUpAccordion();
32
if(defaults.saveState == true){
33
+ checkCookie(defaults.cookie, obj);
34
+ }
35
+ if(defaults.autoExpand == true){
36
+ $('li.'+defaults.classExpand+' > a').addClass(defaults.classActive);
37
}
38
resetAccordion();
39
if(defaults.eventType == 'hover'){
44
timeout: defaults.hoverDelay, // number = milliseconds delay before onMouseOut
45
out: linkOut // function = onMouseOut callback (REQUIRED)
46
};
47
+ $('li a',obj).hoverIntent(config);
48
var configMenu = {
49
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
50
interval: 1000, // number = milliseconds for onMouseOver polling interval
52
timeout: 1000, // number = milliseconds delay before onMouseOut
53
out: menuOut // function = onMouseOut callback (REQUIRED)
54
};
55
+ $(obj).hoverIntent(configMenu);
56
// Disable parent links
57
if(defaults.disableLink == true){
58
+ $('li a',obj).click(function(e){
59
if($(this).siblings('ul').length >0){
60
e.preventDefault();
61
}
62
});
63
}
64
} else {
65
+ $('li a',obj).click(function(e){
66
$activeLi = $(this).parent('li');
67
$parentsLi = $activeLi.parents('li');
68
$parentsUl = $activeLi.parents('ul');
85
}
86
// Write cookie if save state is on
87
if(defaults.saveState == true){
88
+ createCookie(defaults.cookie, obj);
89
}
90
});
91
}
92
// Set up accordion
93
function setUpAccordion(){
94
$arrow = '<span class="'+defaults.classArrow+'"></span>';
95
+ $('> ul',obj).show();
96
+ $('li',obj).each(function(){
97
var classParentLi = defaults.classParent+'-li';
98
if($('> ul',this).length > 0){
99
$('> a',this).addClass(defaults.classParent).append($arrow);
100
}
101
});
102
+ $('> ul',obj).hide();
103
}
104
+
105
+ function linkOver(){
106
+
107
$activeLi = $(this).parent('li');
108
$parentsLi = $activeLi.parents('li');
109
+ $parentsUl = $activeLi.parents('ul');
110
+
111
// Auto close sibling menus
112
if(defaults.autoClose == true){
113
+ autoCloseAccordion($parentsLi, $parentsUl);
114
+
115
+ }
116
+
117
if ($('> ul',$activeLi).is(':visible')){
118
$('ul',$activeLi).slideUp(defaults.speed);
119
$('a',$activeLi).removeClass(defaults.classActive);
120
} else {
121
$(this).siblings('ul').slideToggle(defaults.speed);
122
$('> a',$activeLi).addClass(defaults.classActive);
123
+ }
124
+
125
// Write cookie if save state is on
126
if(defaults.saveState == true){
127
+ createCookie(defaults.cookie, obj);
128
}
129
+ }
130
+
131
function linkOut(){
132
+ }
133
+
134
function menuOver(){
135
+ }
136
+
137
+ function menuOut(){
138
+
139
if(defaults.menuClose == true){
140
+ $('ul',obj).slideUp(defaults.speed);
141
// Reset active links
142
+ $('a',obj).removeClass(defaults.classActive);
143
+ createCookie(defaults.cookie, obj);
144
}
145
+ }
146
+
147
// Auto-Close Open Menu Items
148
function autoCloseAccordion($parentsLi, $parentsUl){
149
+ $('ul',obj).not($parentsUl).slideUp(defaults.speed);
150
// Reset active links
151
+ $('a',obj).removeClass(defaults.classActive);
152
$('> a',$parentsLi).addClass(defaults.classActive);
153
+ }
154
+ // Reset accordion using active links
155
+ function resetAccordion(){
156
+ $('ul',obj).hide();
157
+ $allActiveLi = $('a.'+defaults.classActive,obj);
158
+ $allActiveLi.siblings('ul').show();
159
+ }
160
+ });
161
// Retrieve cookie value and set active items
162
function checkCookie(cookieId, obj){
163
var cookieVal = $.cookie(cookieId);
171
$('> a',$parentsLi).addClass(defaults.classActive);
172
});
173
}
174
}
175
// Write cookie
176
function createCookie(cookieId, obj){
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.designchemical.com
4
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, widget
5
Requires at least: 3.0
6
Tested up to: 3.1
7
- Stable tag: 2.4
8
9
Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery.
10
@@ -19,7 +19,7 @@ The widget has several parameters that can be configured to help cutomise the ve
19
* Click/Hover - Selects the event type that will trigger the menu to open/close
20
* Auto-close open menus - If checked this will allow only one menu item to be expanded at any time. Clicking on a new menu item will automatically close the previous one.
21
* Save menu state (uses cookies) - Selecting this will allow the menu to remember its open/close state when browsing to a new page.
22
- * Auto Expand Based on Current Page/Item (requires "Save State On") - If checked, this option will automatically expand sub-menus based on the current page/post based on the inherent Wordpress custom menu css classes - e.g. select this option if you would like the menu to automatically expand when the user clicks a link other than the accordion menu.
23
* Disable parent links - If selected, any menu items that have child elements will have their links disabled and will only open/close their relevant sub-menus. Do not select this if you want the user to still be able to browse to that item's page.
24
* Close menu (hover only) - If checked the menu will automatically fully close after 1 second when the mouse moves off the menu - only available if event type is "hover"
25
* Show Count - If checked the menu will automatically add a count showing the number of links under each parent menu item
@@ -55,6 +55,9 @@ Another likely cause is due to other non-functioning plugins, which may have err
55
56
== Changelog ==
57
58
= 2.4 =
59
* Added: Ability to auto-expand menu based on the Wordpress current page/menu item classes
60
4
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, widget
5
Requires at least: 3.0
6
Tested up to: 3.1
7
+ Stable tag: 2.5
8
9
Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery.
10
19
* Click/Hover - Selects the event type that will trigger the menu to open/close
20
* Auto-close open menus - If checked this will allow only one menu item to be expanded at any time. Clicking on a new menu item will automatically close the previous one.
21
* Save menu state (uses cookies) - Selecting this will allow the menu to remember its open/close state when browsing to a new page.
22
+ * Auto Expand Based on Current Page/Item - If checked, this option will automatically expand sub-menus based on the current page/post based on the inherent Wordpress custom menu css classes - e.g. select this option if you would like the menu to automatically expand when the user clicks a link other than the accordion menu.
23
* Disable parent links - If selected, any menu items that have child elements will have their links disabled and will only open/close their relevant sub-menus. Do not select this if you want the user to still be able to browse to that item's page.
24
* Close menu (hover only) - If checked the menu will automatically fully close after 1 second when the mouse moves off the menu - only available if event type is "hover"
25
* Show Count - If checked the menu will automatically add a count showing the number of links under each parent menu item
55
56
== Changelog ==
57
58
+ = 2.5 =
59
+ * Added: Auto-expand now independent of save state option
60
+
61
= 2.4 =
62
* Added: Ability to auto-expand menu based on the Wordpress current page/menu item classes
63