Version Description
- Added: Ability to disable parent menu items using a CSS class
- Added: Ability to set menu CSS Class - default "menu"
- Update: Revision to auto-expand system
- Update: jquery.dcjqaccordion.2.8.js
Download this release
Release Info
Developer | remix4 |
Plugin | JQuery Accordion Menu Widget |
Version | 2.6 |
Comparing to | |
See all releases |
Code changes from version 2.5.4 to 2.6
- dcwp_jquery_accordion.php +2 -2
- dcwp_jquery_accordion_widget.php +45 -13
- js/{jquery.dcjqaccordion.2.7.js → jquery.dcjqaccordion.2.8.js} +42 -27
- readme.txt +15 -3
- screenshot-1.png +0 -0
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.
|
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.
|
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.6
|
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.8.js', array('jquery') );
|
28 |
}
|
29 |
add_action( 'wp_footer', array('dc_jqaccordion', 'footer') );
|
30 |
|
dcwp_jquery_accordion_widget.php
CHANGED
@@ -34,6 +34,8 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
34 |
'showCount' => 'off',
|
35 |
'speed' => 'slow',
|
36 |
'disableLink' => 'on',
|
|
|
|
|
37 |
'skin' => 'demo.css'
|
38 |
);
|
39 |
}
|
@@ -53,6 +55,8 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
53 |
return;
|
54 |
|
55 |
$instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
|
|
|
|
56 |
|
57 |
echo $args['before_widget'];
|
58 |
|
@@ -64,7 +68,14 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
64 |
<div class="dcjq-accordion" id="<?php echo $this->id.'-item'; ?>">
|
65 |
|
66 |
<?php
|
67 |
-
wp_nav_menu(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
?>
|
69 |
|
70 |
</div>
|
@@ -82,6 +93,8 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
82 |
$instance['saveState'] = $new_instance['saveState'];
|
83 |
$instance['autoExpand'] = $new_instance['autoExpand'];
|
84 |
$instance['disableLink'] = $new_instance['disableLink'];
|
|
|
|
|
85 |
$instance['showCount'] = $new_instance['showCount'];
|
86 |
$instance['event'] = strip_tags( stripslashes($new_instance['event']) );
|
87 |
$instance['skin'] = $new_instance['skin'];
|
@@ -99,6 +112,8 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
99 |
if(! isset($instance['saveState']) ){ $instance['saveState'] = 'false'; }
|
100 |
if(! isset($instance['menuClose']) ){ $instance['menuClose'] = 'false'; }
|
101 |
if(! isset($instance['disableLink']) ){ $instance['disableLink'] = 'false'; }
|
|
|
|
|
102 |
if(! isset($instance['autoExpand']) ){ $instance['autoExpand'] = 'false'; }
|
103 |
if(! isset($instance['showCount']) ){ $instance['showCount'] = 'false'; }
|
104 |
$event = isset( $instance['event'] ) ? $instance['event'] : '';
|
@@ -120,7 +135,7 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
120 |
?>
|
121 |
<p>
|
122 |
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
|
123 |
-
<input type="text"
|
124 |
</p>
|
125 |
<p>
|
126 |
<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
|
@@ -156,7 +171,15 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
156 |
<label for="<?php echo $this->get_field_id('menuClose'); ?>"><?php _e( 'Close Menu (hover only)' , 'dcjq-accordion' ); ?></label><br />
|
157 |
|
158 |
<input type="checkbox" value="true" class="checkbox" id="<?php echo $this->get_field_id('showCount'); ?>" name="<?php echo $this->get_field_name('showCount'); ?>"<?php checked( $showCount, 'true' ); ?> />
|
159 |
-
<label for="<?php echo $this->get_field_id('showCount'); ?>"><?php _e( 'Show Count' , 'dcjq-accordion' ); ?></label
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
</p>
|
161 |
<p>
|
162 |
<label for="<?php echo $this->get_field_id('hoverDelay'); ?>"><?php _e('Hover Delay:', 'dcjq-accordion'); ?>
|
@@ -213,9 +236,10 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
213 |
if(!is_admin()){
|
214 |
|
215 |
$all_widgets = $this->get_settings();
|
216 |
-
|
217 |
foreach ($all_widgets as $key => $wpdcjqaccordion){
|
218 |
-
$widget_id = $this->id_base . '-' . $key;
|
|
|
219 |
if(is_active_widget(false, $widget_id, $this->id_base)){
|
220 |
|
221 |
$skin = $wpdcjqaccordion['skin'];
|
@@ -242,37 +266,45 @@ class dc_jqaccordion_widget extends WP_Widget {
|
|
242 |
if(is_active_widget(false, $widget_id, $this->id_base)){
|
243 |
|
244 |
$autoClose = $wpdcjqaccordion['autoClose'];
|
245 |
-
if($autoClose == ''){$autoClose = 'false';}
|
246 |
|
247 |
$saveState = $wpdcjqaccordion['saveState'];
|
248 |
-
if($saveState == ''){$saveState = 'false';}
|
249 |
|
250 |
$disableLink = $wpdcjqaccordion['disableLink'];
|
251 |
-
if($disableLink == ''){$disableLink = 'false';}
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
$menuClose = $wpdcjqaccordion['menuClose'];
|
254 |
-
if($menuClose == ''){$menuClose = 'false';}
|
255 |
|
256 |
$autoExpand = $wpdcjqaccordion['autoExpand'];
|
257 |
if($autoExpand == ''){$autoExpand = 'false';}
|
258 |
|
259 |
$showCount = $wpdcjqaccordion['showCount'];
|
260 |
-
if($showCount == ''){$showCount = 'false';}
|
261 |
|
262 |
$hoverDelay = $wpdcjqaccordion['hoverDelay'];
|
263 |
-
if($hoverDelay == ''){$hoverDelay = 600;}
|
|
|
|
|
264 |
|
265 |
?>
|
266 |
<script type="text/javascript">
|
267 |
jQuery(document).ready(function($) {
|
268 |
-
jQuery('
|
269 |
eventType: '<?php echo $wpdcjqaccordion['event']; ?>',
|
270 |
hoverDelay: <?php echo $hoverDelay; ?>,
|
271 |
menuClose: <?php echo $menuClose; ?>,
|
272 |
autoClose: <?php echo $autoClose; ?>,
|
273 |
saveState: <?php echo $saveState; ?>,
|
274 |
autoExpand: <?php echo $autoExpand; ?>,
|
275 |
-
classExpand: 'current-menu-
|
|
|
276 |
showCount: <?php echo $showCount; ?>,
|
277 |
disableLink: <?php echo $disableLink; ?>,
|
278 |
cookie: '<?php echo $widget_id; ?>',
|
34 |
'showCount' => 'off',
|
35 |
'speed' => 'slow',
|
36 |
'disableLink' => 'on',
|
37 |
+
'classDisable' => 'on',
|
38 |
+
'classMenu' => '',
|
39 |
'skin' => 'demo.css'
|
40 |
);
|
41 |
}
|
55 |
return;
|
56 |
|
57 |
$instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
|
58 |
+
|
59 |
+
$classMenu = ($instance['classMenu'] != '') ? $instance['classMenu'] : 'menu';
|
60 |
|
61 |
echo $args['before_widget'];
|
62 |
|
68 |
<div class="dcjq-accordion" id="<?php echo $this->id.'-item'; ?>">
|
69 |
|
70 |
<?php
|
71 |
+
wp_nav_menu(
|
72 |
+
array(
|
73 |
+
'fallback_cb' => '',
|
74 |
+
'menu' => $nav_menu,
|
75 |
+
'container' => false,
|
76 |
+
'menu_class' => $classMenu
|
77 |
+
)
|
78 |
+
);
|
79 |
?>
|
80 |
|
81 |
</div>
|
93 |
$instance['saveState'] = $new_instance['saveState'];
|
94 |
$instance['autoExpand'] = $new_instance['autoExpand'];
|
95 |
$instance['disableLink'] = $new_instance['disableLink'];
|
96 |
+
$instance['classDisable'] = $new_instance['classDisable'];
|
97 |
+
$instance['classMenu'] = $new_instance['classMenu'];
|
98 |
$instance['showCount'] = $new_instance['showCount'];
|
99 |
$instance['event'] = strip_tags( stripslashes($new_instance['event']) );
|
100 |
$instance['skin'] = $new_instance['skin'];
|
112 |
if(! isset($instance['saveState']) ){ $instance['saveState'] = 'false'; }
|
113 |
if(! isset($instance['menuClose']) ){ $instance['menuClose'] = 'false'; }
|
114 |
if(! isset($instance['disableLink']) ){ $instance['disableLink'] = 'false'; }
|
115 |
+
if(! isset($instance['classDisable']) ){ $instance['classDisable'] = ''; }
|
116 |
+
if(! isset($instance['classMenu']) ){ $instance['classMenu'] = ''; }
|
117 |
if(! isset($instance['autoExpand']) ){ $instance['autoExpand'] = 'false'; }
|
118 |
if(! isset($instance['showCount']) ){ $instance['showCount'] = 'false'; }
|
119 |
$event = isset( $instance['event'] ) ? $instance['event'] : '';
|
135 |
?>
|
136 |
<p>
|
137 |
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label>
|
138 |
+
<input type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" size="20" />
|
139 |
</p>
|
140 |
<p>
|
141 |
<label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label>
|
171 |
<label for="<?php echo $this->get_field_id('menuClose'); ?>"><?php _e( 'Close Menu (hover only)' , 'dcjq-accordion' ); ?></label><br />
|
172 |
|
173 |
<input type="checkbox" value="true" class="checkbox" id="<?php echo $this->get_field_id('showCount'); ?>" name="<?php echo $this->get_field_name('showCount'); ?>"<?php checked( $showCount, 'true' ); ?> />
|
174 |
+
<label for="<?php echo $this->get_field_id('showCount'); ?>"><?php _e( 'Show Count' , 'dcjq-accordion' ); ?></label>
|
175 |
+
</p>
|
176 |
+
<p>
|
177 |
+
<label for="<?php echo $this->get_field_id('classMenu'); ?>"><?php _e('Menu Class:') ?></label>
|
178 |
+
<input type="text" id="<?php echo $this->get_field_id('classMenu'); ?>" name="<?php echo $this->get_field_name('classMenu'); ?>" value="<?php echo $classMenu; ?>" size="15" />
|
179 |
+
</p>
|
180 |
+
<p>
|
181 |
+
<label for="<?php echo $this->get_field_id('classDisable'); ?>"><?php _e('Disable Class:') ?></label>
|
182 |
+
<input type="text" id="<?php echo $this->get_field_id('classDisable'); ?>" name="<?php echo $this->get_field_name('classDisable'); ?>" value="<?php echo $classDisable; ?>" size="15" />
|
183 |
</p>
|
184 |
<p>
|
185 |
<label for="<?php echo $this->get_field_id('hoverDelay'); ?>"><?php _e('Hover Delay:', 'dcjq-accordion'); ?>
|
236 |
if(!is_admin()){
|
237 |
|
238 |
$all_widgets = $this->get_settings();
|
239 |
+
|
240 |
foreach ($all_widgets as $key => $wpdcjqaccordion){
|
241 |
+
$widget_id = $this->id_base . '-' . $key;
|
242 |
+
|
243 |
if(is_active_widget(false, $widget_id, $this->id_base)){
|
244 |
|
245 |
$skin = $wpdcjqaccordion['skin'];
|
266 |
if(is_active_widget(false, $widget_id, $this->id_base)){
|
267 |
|
268 |
$autoClose = $wpdcjqaccordion['autoClose'];
|
269 |
+
if($autoClose == ''){$autoClose = 'false';}
|
270 |
|
271 |
$saveState = $wpdcjqaccordion['saveState'];
|
272 |
+
if($saveState == ''){$saveState = 'false';}
|
273 |
|
274 |
$disableLink = $wpdcjqaccordion['disableLink'];
|
275 |
+
if($disableLink == ''){$disableLink = 'false';}
|
276 |
+
|
277 |
+
$classDisable = $wpdcjqaccordion['classDisable'];
|
278 |
+
|
279 |
+
$classMenu = $wpdcjqaccordion['classMenu'];
|
280 |
+
if($classMenu == ''){$classMenu = 'menu';}
|
281 |
|
282 |
$menuClose = $wpdcjqaccordion['menuClose'];
|
283 |
+
if($menuClose == ''){$menuClose = 'false';}
|
284 |
|
285 |
$autoExpand = $wpdcjqaccordion['autoExpand'];
|
286 |
if($autoExpand == ''){$autoExpand = 'false';}
|
287 |
|
288 |
$showCount = $wpdcjqaccordion['showCount'];
|
289 |
+
if($showCount == ''){$showCount = 'false';}
|
290 |
|
291 |
$hoverDelay = $wpdcjqaccordion['hoverDelay'];
|
292 |
+
if($hoverDelay == ''){$hoverDelay = 600;}
|
293 |
+
|
294 |
+
$accordionId = '#'.$widget_id.'-item .'.$classMenu;
|
295 |
|
296 |
?>
|
297 |
<script type="text/javascript">
|
298 |
jQuery(document).ready(function($) {
|
299 |
+
jQuery('<?php echo $accordionId; ?>').dcAccordion({
|
300 |
eventType: '<?php echo $wpdcjqaccordion['event']; ?>',
|
301 |
hoverDelay: <?php echo $hoverDelay; ?>,
|
302 |
menuClose: <?php echo $menuClose; ?>,
|
303 |
autoClose: <?php echo $autoClose; ?>,
|
304 |
saveState: <?php echo $saveState; ?>,
|
305 |
autoExpand: <?php echo $autoExpand; ?>,
|
306 |
+
classExpand: 'current-menu-item',
|
307 |
+
classDisable: '<?php echo $classDisable; ?>',
|
308 |
showCount: <?php echo $showCount; ?>,
|
309 |
disableLink: <?php echo $disableLink; ?>,
|
310 |
cookie: '<?php echo $widget_id; ?>',
|
js/{jquery.dcjqaccordion.2.7.js → jquery.dcjqaccordion.2.8.js}
RENAMED
@@ -14,6 +14,7 @@
|
|
14 |
classParent : 'dcjq-parent',
|
15 |
classActive : 'active',
|
16 |
classExpand : 'dcjq-current-parent',
|
|
|
17 |
eventType : 'click',
|
18 |
hoverDelay : 300,
|
19 |
menuClose : true,
|
@@ -28,12 +29,21 @@
|
|
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(
|
37 |
}
|
38 |
resetAccordion();
|
39 |
if(defaults.eventType == 'hover'){
|
@@ -44,7 +54,7 @@
|
|
44 |
timeout: defaults.hoverDelay, // number = milliseconds delay before onMouseOut
|
45 |
out: linkOut // function = onMouseOut callback (REQUIRED)
|
46 |
};
|
47 |
-
$
|
48 |
var configMenu = {
|
49 |
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
|
50 |
interval: 1000, // number = milliseconds for onMouseOver polling interval
|
@@ -55,14 +65,14 @@
|
|
55 |
$(obj).hoverIntent(configMenu);
|
56 |
// Disable parent links
|
57 |
if(defaults.disableLink == true){
|
58 |
-
$
|
59 |
if($(this).siblings('ul').length >0){
|
60 |
e.preventDefault();
|
61 |
}
|
62 |
});
|
63 |
}
|
64 |
} else {
|
65 |
-
$
|
66 |
$activeLi = $(this).parent('li');
|
67 |
$parentsLi = $activeLi.parents('li');
|
68 |
$parentsUl = $activeLi.parents('ul');
|
@@ -78,14 +88,14 @@
|
|
78 |
}
|
79 |
if ($('> ul',$activeLi).is(':visible')){
|
80 |
$('ul',$activeLi).slideUp(defaults.speed);
|
81 |
-
$('a',$activeLi).removeClass(
|
82 |
} else {
|
83 |
$(this).siblings('ul').slideToggle(defaults.speed);
|
84 |
-
$('> a',$activeLi).addClass(
|
85 |
}
|
86 |
// Write cookie if save state is on
|
87 |
if(defaults.saveState == true){
|
88 |
-
createCookie(defaults.cookie, obj);
|
89 |
}
|
90 |
});
|
91 |
}
|
@@ -93,13 +103,16 @@
|
|
93 |
function setUpAccordion(){
|
94 |
$arrow = '<span class="'+defaults.classArrow+'"></span>';
|
95 |
var classParentLi = defaults.classParent+'-li';
|
96 |
-
$
|
97 |
$('li',obj).each(function(){
|
98 |
if($('> ul',this).length > 0){
|
99 |
$('> a',this).addClass(defaults.classParent).append($arrow);
|
100 |
}
|
101 |
});
|
102 |
-
$
|
|
|
|
|
|
|
103 |
if(defaults.showCount == true){
|
104 |
$('li.'+classParentLi,obj).each(function(){
|
105 |
if(defaults.disableLink == true){
|
@@ -126,15 +139,15 @@
|
|
126 |
|
127 |
if ($('> ul',$activeLi).is(':visible')){
|
128 |
$('ul',$activeLi).slideUp(defaults.speed);
|
129 |
-
$('a',$activeLi).removeClass(
|
130 |
} else {
|
131 |
$(this).siblings('ul').slideToggle(defaults.speed);
|
132 |
-
$('> a',$activeLi).addClass(
|
133 |
}
|
134 |
|
135 |
// Write cookie if save state is on
|
136 |
if(defaults.saveState == true){
|
137 |
-
createCookie(defaults.cookie, obj);
|
138 |
}
|
139 |
}
|
140 |
|
@@ -147,46 +160,48 @@
|
|
147 |
function menuOut(){
|
148 |
|
149 |
if(defaults.menuClose == true){
|
150 |
-
$
|
151 |
// Reset active links
|
152 |
-
$('a',obj).removeClass(
|
153 |
-
createCookie(defaults.cookie, obj);
|
154 |
}
|
155 |
}
|
156 |
|
157 |
// Auto-Close Open Menu Items
|
158 |
function autoCloseAccordion($parentsLi, $parentsUl){
|
159 |
-
$
|
160 |
// Reset active links
|
161 |
-
$('a',obj).removeClass(
|
162 |
-
$('> a',$parentsLi).addClass(
|
163 |
}
|
164 |
// Reset accordion using active links
|
165 |
function resetAccordion(){
|
166 |
-
$
|
167 |
-
$
|
168 |
-
$
|
|
|
|
|
169 |
}
|
170 |
});
|
171 |
// Retrieve cookie value and set active items
|
172 |
-
function checkCookie(cookieId, obj){
|
173 |
var cookieVal = $.cookie(cookieId);
|
174 |
if(cookieVal != null){
|
175 |
// create array from cookie string
|
176 |
var activeArray = cookieVal.split(',');
|
177 |
$.each(activeArray, function(index,value){
|
178 |
var $cookieLi = $('li:eq('+value+')',obj);
|
179 |
-
$('> a',$cookieLi).addClass(
|
180 |
var $parentsLi = $cookieLi.parents('li');
|
181 |
-
$('> a',$parentsLi).addClass(
|
182 |
});
|
183 |
}
|
184 |
}
|
185 |
// Write cookie
|
186 |
-
function createCookie(cookieId, obj){
|
187 |
var activeIndex = [];
|
188 |
// Create array of active items index value
|
189 |
-
$('li a.'+
|
190 |
var $arrayItem = $(this).parent('li');
|
191 |
var itemIndex = $('li',obj).index($arrayItem);
|
192 |
activeIndex.push(itemIndex);
|
14 |
classParent : 'dcjq-parent',
|
15 |
classActive : 'active',
|
16 |
classExpand : 'dcjq-current-parent',
|
17 |
+
classDisable : '',
|
18 |
eventType : 'click',
|
19 |
hoverDelay : 300,
|
20 |
menuClose : true,
|
29 |
var options = $.extend(defaults, options);
|
30 |
this.each(function(options){
|
31 |
var obj = this;
|
32 |
+
$objLinks = $('li > a',obj);
|
33 |
+
$objSub = $('li > ul',obj);
|
34 |
+
if(defaults.classDisable){
|
35 |
+
$objLinks = $('li:not(.'+defaults.classDisable+') > a',obj);
|
36 |
+
$objSub = $('li:not(.'+defaults.classDisable+') > ul',obj);
|
37 |
+
}
|
38 |
+
|
39 |
+
classActive = defaults.classActive;
|
40 |
+
|
41 |
setUpAccordion();
|
42 |
if(defaults.saveState == true){
|
43 |
+
checkCookie(defaults.cookie, obj, classActive);
|
44 |
}
|
45 |
if(defaults.autoExpand == true){
|
46 |
+
$('li.'+defaults.classExpand+' > a').addClass(classActive);
|
47 |
}
|
48 |
resetAccordion();
|
49 |
if(defaults.eventType == 'hover'){
|
54 |
timeout: defaults.hoverDelay, // number = milliseconds delay before onMouseOut
|
55 |
out: linkOut // function = onMouseOut callback (REQUIRED)
|
56 |
};
|
57 |
+
$objLinks.hoverIntent(config);
|
58 |
var configMenu = {
|
59 |
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
|
60 |
interval: 1000, // number = milliseconds for onMouseOver polling interval
|
65 |
$(obj).hoverIntent(configMenu);
|
66 |
// Disable parent links
|
67 |
if(defaults.disableLink == true){
|
68 |
+
$objLinks.click(function(e){
|
69 |
if($(this).siblings('ul').length >0){
|
70 |
e.preventDefault();
|
71 |
}
|
72 |
});
|
73 |
}
|
74 |
} else {
|
75 |
+
$objLinks.click(function(e){
|
76 |
$activeLi = $(this).parent('li');
|
77 |
$parentsLi = $activeLi.parents('li');
|
78 |
$parentsUl = $activeLi.parents('ul');
|
88 |
}
|
89 |
if ($('> ul',$activeLi).is(':visible')){
|
90 |
$('ul',$activeLi).slideUp(defaults.speed);
|
91 |
+
$('a',$activeLi).removeClass(classActive);
|
92 |
} else {
|
93 |
$(this).siblings('ul').slideToggle(defaults.speed);
|
94 |
+
$('> a',$activeLi).addClass(classActive);
|
95 |
}
|
96 |
// Write cookie if save state is on
|
97 |
if(defaults.saveState == true){
|
98 |
+
createCookie(defaults.cookie, obj, classActive);
|
99 |
}
|
100 |
});
|
101 |
}
|
103 |
function setUpAccordion(){
|
104 |
$arrow = '<span class="'+defaults.classArrow+'"></span>';
|
105 |
var classParentLi = defaults.classParent+'-li';
|
106 |
+
$objSub.show();
|
107 |
$('li',obj).each(function(){
|
108 |
if($('> ul',this).length > 0){
|
109 |
$('> a',this).addClass(defaults.classParent).append($arrow);
|
110 |
}
|
111 |
});
|
112 |
+
$objSub.hide();
|
113 |
+
if(defaults.classDisable){
|
114 |
+
$('li.'+defaults.classDisable+' > ul').show();
|
115 |
+
}
|
116 |
if(defaults.showCount == true){
|
117 |
$('li.'+classParentLi,obj).each(function(){
|
118 |
if(defaults.disableLink == true){
|
139 |
|
140 |
if ($('> ul',$activeLi).is(':visible')){
|
141 |
$('ul',$activeLi).slideUp(defaults.speed);
|
142 |
+
$('a',$activeLi).removeClass(classActive);
|
143 |
} else {
|
144 |
$(this).siblings('ul').slideToggle(defaults.speed);
|
145 |
+
$('> a',$activeLi).addClass(classActive);
|
146 |
}
|
147 |
|
148 |
// Write cookie if save state is on
|
149 |
if(defaults.saveState == true){
|
150 |
+
createCookie(defaults.cookie, obj, classActive);
|
151 |
}
|
152 |
}
|
153 |
|
160 |
function menuOut(){
|
161 |
|
162 |
if(defaults.menuClose == true){
|
163 |
+
$objSub.slideUp(defaults.speed);
|
164 |
// Reset active links
|
165 |
+
$('a',obj).removeClass(classActive);
|
166 |
+
createCookie(defaults.cookie, obj, classActive);
|
167 |
}
|
168 |
}
|
169 |
|
170 |
// Auto-Close Open Menu Items
|
171 |
function autoCloseAccordion($parentsLi, $parentsUl){
|
172 |
+
$objSub.not($parentsUl).slideUp(defaults.speed);
|
173 |
// Reset active links
|
174 |
+
$('a',obj).removeClass(classActive);
|
175 |
+
$('> a',$parentsLi).addClass(classActive);
|
176 |
}
|
177 |
// Reset accordion using active links
|
178 |
function resetAccordion(){
|
179 |
+
$objSub.hide();
|
180 |
+
var $parentsLi = $('a.'+classActive,obj).parents('li');
|
181 |
+
$('> a',$parentsLi).addClass(classActive);
|
182 |
+
$allActiveLi = $('a.'+classActive,obj);
|
183 |
+
$($allActiveLi).siblings('ul').show();
|
184 |
}
|
185 |
});
|
186 |
// Retrieve cookie value and set active items
|
187 |
+
function checkCookie(cookieId, obj, classActive){
|
188 |
var cookieVal = $.cookie(cookieId);
|
189 |
if(cookieVal != null){
|
190 |
// create array from cookie string
|
191 |
var activeArray = cookieVal.split(',');
|
192 |
$.each(activeArray, function(index,value){
|
193 |
var $cookieLi = $('li:eq('+value+')',obj);
|
194 |
+
$('> a',$cookieLi).addClass(classActive);
|
195 |
var $parentsLi = $cookieLi.parents('li');
|
196 |
+
$('> a',$parentsLi).addClass(classActive);
|
197 |
});
|
198 |
}
|
199 |
}
|
200 |
// Write cookie
|
201 |
+
function createCookie(cookieId, obj, classActive){
|
202 |
var activeIndex = [];
|
203 |
// Create array of active items index value
|
204 |
+
$('li a.'+classActive,obj).each(function(i){
|
205 |
var $arrayItem = $(this).parent('li');
|
206 |
var itemIndex = $('li',obj).index($arrayItem);
|
207 |
activeIndex.push(itemIndex);
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: remix4
|
|
3 |
Donate link: http://www.designchemical.com/blog/index.php/wordpress-plugins/wordpress-plugin-jquery-vertical-accordion-menu-widget/#form-donate
|
4 |
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, widget
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery.
|
10 |
|
@@ -23,13 +23,16 @@ The widget has several parameters that can be configured to help cutomise the ve
|
|
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
|
|
|
|
|
26 |
* Hover delay - This setting adds a delay to the hover event to help prevent the menu opening/closing accidentally. A higher number means the cursor must stop moving for longer before the menu action will trigger
|
27 |
* Animation Speed - The speed at which the menu will open/close
|
28 |
* Skin - Several sample skins are available to give examples of css that can be used to style your accordion menu
|
29 |
|
30 |
Note: care should be taken when selecting the hover event as this may impact useability - adding a hover delay and reducing the animation speed may help reduce problems with useability
|
31 |
|
32 |
-
[__See
|
|
|
33 |
|
34 |
== Installation ==
|
35 |
|
@@ -48,6 +51,9 @@ One main reason for the menu failing to load properly is caused by the necessary
|
|
48 |
|
49 |
Another likely cause is due to other non-functioning plugins, which may have errors and cause the plugin javascript to not load. Remove any unwanted plugins and try again. Checking with Firebug will show where these error are occuring.
|
50 |
|
|
|
|
|
|
|
51 |
== Screenshots ==
|
52 |
|
53 |
1. Widget in edit mode
|
@@ -55,6 +61,12 @@ Another likely cause is due to other non-functioning plugins, which may have err
|
|
55 |
|
56 |
== Changelog ==
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
= 2.5.4 =
|
59 |
* Fix: Bug with save state option
|
60 |
|
3 |
Donate link: http://www.designchemical.com/blog/index.php/wordpress-plugins/wordpress-plugin-jquery-vertical-accordion-menu-widget/#form-donate
|
4 |
Tags: jquery, dropdown, menu, vertical accordion, animated, css, navigation, widget
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.13
|
7 |
+
Stable tag: 2.6
|
8 |
|
9 |
Creates a widget, which allows you to create vertical accordion menus from any Wordpress custom menu using jQuery.
|
10 |
|
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
|
26 |
+
* Class Menu - Set the CSS class of the Wordpress menu. If blank the default class "menu" will be used
|
27 |
+
* Class Disable - Input the CSS class for parent menu items that should be disabled - i.e. the child sub-menu remains open
|
28 |
* Hover delay - This setting adds a delay to the hover event to help prevent the menu opening/closing accidentally. A higher number means the cursor must stop moving for longer before the menu action will trigger
|
29 |
* Animation Speed - The speed at which the menu will open/close
|
30 |
* Skin - Several sample skins are available to give examples of css that can be used to style your accordion menu
|
31 |
|
32 |
Note: care should be taken when selecting the hover event as this may impact useability - adding a hover delay and reducing the animation speed may help reduce problems with useability
|
33 |
|
34 |
+
[__See Demo__](http://www.designchemical.com/lab/demo-wordpress-vertical-accordion-menu-plugin/)
|
35 |
+
[__Plugin Home Page__](http://www.designchemical.com/blog/index.php/wordpress-plugins/wordpress-plugin-jquery-vertical-accordion-menu-widget/)
|
36 |
|
37 |
== Installation ==
|
38 |
|
51 |
|
52 |
Another likely cause is due to other non-functioning plugins, which may have errors and cause the plugin javascript to not load. Remove any unwanted plugins and try again. Checking with Firebug will show where these error are occuring.
|
53 |
|
54 |
+
[__Also check out our jquery accordion menu faq page__](http://www.designchemical.com/blog/index.php/frequently-asked-questions/jquery-vertical-accordion-menu/)
|
55 |
+
|
56 |
+
|
57 |
== Screenshots ==
|
58 |
|
59 |
1. Widget in edit mode
|
61 |
|
62 |
== Changelog ==
|
63 |
|
64 |
+
= 2.6 =
|
65 |
+
* Added: Ability to disable parent menu items using a CSS class
|
66 |
+
* Added: Ability to set menu CSS Class - default "menu"
|
67 |
+
* Update: Revision to auto-expand system
|
68 |
+
* Update: jquery.dcjqaccordion.2.8.js
|
69 |
+
|
70 |
= 2.5.4 =
|
71 |
* Fix: Bug with save state option
|
72 |
|
screenshot-1.png
CHANGED
Binary file
|