Version Description
- New Feature: "Hover" event added (options are now Hover Intent, Hover or Click)
- New Feature: Menu Item Description support added
- New Feature: Add "Active Menu Instance" setting to allow mega menu to only be applied to an individual instance of a wp_nav_menu call (rather than all of them)
- Fix: Hover not working on some devices with touch screens. This has been tested for Hover, Hover Intent and Click on: Mac FireFox/Safari/Chrome, Windows Edge/IE9/IE10/IE11/FireFox/Chrome, iPhone, iPad Chrome/Safari, Andoid Default/Chrome. If you have problems with touch or hover, please post in the support forums detailing exactly which Operating System, Browser and Event you are using so that I can reproduce the issue here.
- Fix: Mobile menu now always switches to click, even on desktops
- Fix: Responsive Breakpoint validation
- Fix: Swiping background on touch devices hides sub menus
- Fix: Remove margin from right aligned menu items on mobile
- Fix: Apply hover styling to current-page-ancestor
- Fix: Fix WPML cache clearing when CSS Output is set to Output in head
- Fix: Allow single quotes in theme editor custom CSS
- Fix: Allow single quotes in Menu Toggle toggle block text
- Fix: Improve theme editor settings validation
- Change: Remove permanent 'Go Pro' nag from Plugins page.
- Change: Add "mega-menu-location" body class when MMM is enabled for a location to pave the way for automatic theme integration
- Improvement: Add ".mega-multi-line" CSS to aid display of menu items with br tags in title
Download this release
Release Info
Developer | megamenu |
Plugin | Max Mega Menu |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.3.4 to 2.3
- classes/menu-item-manager.class.php +18 -3
- classes/settings.class.php +44 -2
- classes/style-manager.class.php +5 -213
- classes/walker.class.php +8 -1
- css/admin/menus.css +3 -1
- css/admin/settings.css +12 -1
- css/megamenu.scss +56 -24
- js/maxmegamenu.js +55 -157
- megamenu.php +48 -5
- readme.txt +31 -24
classes/menu-item-manager.class.php
CHANGED
@@ -34,9 +34,9 @@ class Mega_Menu_Menu_Item_Manager {
|
|
34 |
add_filter( 'megamenu_tabs', array( $this, 'add_mega_menu_tab'), 10, 5 );
|
35 |
add_filter( 'megamenu_tabs', array( $this, 'add_general_settings_tab'), 10, 5 );
|
36 |
add_filter( 'megamenu_tabs', array( $this, 'add_icon_tab'), 10, 5 );
|
37 |
-
add_filter( 'megamenu_tabs', array( $this, 'add_custom_styling_tab'), 10, 5 );
|
38 |
-
add_filter( 'megamenu_tabs', array( $this, 'add_roles_tab'), 10, 5 );
|
39 |
-
add_filter( 'megamenu_tabs', array( $this, 'add_replacements_tab'), 10, 5 );
|
40 |
|
41 |
}
|
42 |
|
@@ -536,6 +536,21 @@ class Mega_Menu_Menu_Item_Manager {
|
|
536 |
'title' => __("Dashicons", "megamenu"),
|
537 |
'active' => ! isset( $menu_item_meta['icon'] ) || ( isset( $menu_item_meta['icon'] ) && substr( $menu_item_meta['icon'], 0, strlen("dash") ) === "dash" || $menu_item_meta['icon'] == 'disabled' ),
|
538 |
'content' => $this->dashicon_selector()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
)
|
540 |
);
|
541 |
|
34 |
add_filter( 'megamenu_tabs', array( $this, 'add_mega_menu_tab'), 10, 5 );
|
35 |
add_filter( 'megamenu_tabs', array( $this, 'add_general_settings_tab'), 10, 5 );
|
36 |
add_filter( 'megamenu_tabs', array( $this, 'add_icon_tab'), 10, 5 );
|
37 |
+
//add_filter( 'megamenu_tabs', array( $this, 'add_custom_styling_tab'), 10, 5 );
|
38 |
+
//add_filter( 'megamenu_tabs', array( $this, 'add_roles_tab'), 10, 5 );
|
39 |
+
//add_filter( 'megamenu_tabs', array( $this, 'add_replacements_tab'), 10, 5 );
|
40 |
|
41 |
}
|
42 |
|
536 |
'title' => __("Dashicons", "megamenu"),
|
537 |
'active' => ! isset( $menu_item_meta['icon'] ) || ( isset( $menu_item_meta['icon'] ) && substr( $menu_item_meta['icon'], 0, strlen("dash") ) === "dash" || $menu_item_meta['icon'] == 'disabled' ),
|
538 |
'content' => $this->dashicon_selector()
|
539 |
+
),
|
540 |
+
'fontawesome' => array(
|
541 |
+
'title' => __("Font Awesome", "megamenu"),
|
542 |
+
'active' => false,
|
543 |
+
'content' => str_replace( "{link}", "<a target='_blank' href='https://www.maxmegamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __("Max Mega Menu Pro", "megamenu") . "</a>", __("Get access to over 400 Font Awesome Icons with {link}", "megamenu") )
|
544 |
+
),
|
545 |
+
'genericons' => array(
|
546 |
+
'title' => __("Genericons", "megamenu"),
|
547 |
+
'active' => false,
|
548 |
+
'content' => str_replace( "{link}", "<a target='_blank' href='https://www.maxmegamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __("Max Mega Menu Pro", "megamenu") . "</a>", __("Choose from over 100 genericons with {link}", "megamenu") )
|
549 |
+
),
|
550 |
+
'custom' => array(
|
551 |
+
'title' => __("Custom Icon", "megamenu"),
|
552 |
+
'active' => false,
|
553 |
+
'content' => str_replace( "{link}", "<a target='_blank' href='https://www.maxmegamenu.com/upgrade/?utm_source=free&utm_medium=icon&utm_campaign=pro'>" . __("Max Mega Menu Pro", "megamenu") . "</a>", __("Select icons from your media library with {link}", "megamenu") )
|
554 |
)
|
555 |
);
|
556 |
|
classes/settings.class.php
CHANGED
@@ -268,7 +268,6 @@ class Mega_Menu_Settings {
|
|
268 |
if ( isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ) {
|
269 |
|
270 |
$submitted_settings = apply_filters( "megamenu_submitted_settings", $_POST['settings'] );
|
271 |
-
|
272 |
$existing_settings = get_option( 'megamenu_settings' );
|
273 |
|
274 |
$new_settings = array_merge( (array)$existing_settings, $submitted_settings );
|
@@ -624,7 +623,8 @@ class Mega_Menu_Settings {
|
|
624 |
$css = isset( $saved_settings['css'] ) ? $saved_settings['css'] : 'fs';
|
625 |
$mobile_second_click = isset( $saved_settings['second_click'] ) ? $saved_settings['second_click'] : 'close';
|
626 |
$mobile_behaviour = isset( $saved_settings['mobile_behaviour'] ) ? $saved_settings['mobile_behaviour'] : 'standard';
|
627 |
-
|
|
|
628 |
|
629 |
?>
|
630 |
|
@@ -688,6 +688,48 @@ class Mega_Menu_Settings {
|
|
688 |
</div>
|
689 |
</td>
|
690 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
691 |
</table>
|
692 |
|
693 |
<?php do_action( "megamenu_general_settings", $saved_settings ); ?>
|
268 |
if ( isset( $_POST['settings'] ) && is_array( $_POST['settings'] ) ) {
|
269 |
|
270 |
$submitted_settings = apply_filters( "megamenu_submitted_settings", $_POST['settings'] );
|
|
|
271 |
$existing_settings = get_option( 'megamenu_settings' );
|
272 |
|
273 |
$new_settings = array_merge( (array)$existing_settings, $submitted_settings );
|
623 |
$css = isset( $saved_settings['css'] ) ? $saved_settings['css'] : 'fs';
|
624 |
$mobile_second_click = isset( $saved_settings['second_click'] ) ? $saved_settings['second_click'] : 'close';
|
625 |
$mobile_behaviour = isset( $saved_settings['mobile_behaviour'] ) ? $saved_settings['mobile_behaviour'] : 'standard';
|
626 |
+
$descriptions = isset( $saved_settings['descriptions'] ) ? $saved_settings['descriptions'] : 'disabled';
|
627 |
+
$locations = get_registered_nav_menus();
|
628 |
|
629 |
?>
|
630 |
|
688 |
</div>
|
689 |
</td>
|
690 |
</tr>
|
691 |
+
<tr>
|
692 |
+
<td class='mega-name'>
|
693 |
+
<?php _e("Menu Item Descriptions", "megamenu"); ?>
|
694 |
+
<div class='mega-description'>
|
695 |
+
<?php _e("", "megamenu"); ?>
|
696 |
+
</div>
|
697 |
+
</td>
|
698 |
+
<td class='mega-value'>
|
699 |
+
<select name='settings[descriptions]'>
|
700 |
+
<option value='disabled' <?php echo selected( $descriptions == 'disabled'); ?>><?php _e("Disabled", "megamenu"); ?></option>
|
701 |
+
<option value='enabled' <?php echo selected( $descriptions == 'enabled'); ?>><?php _e("Enabled", "megamenu"); ?></option>
|
702 |
+
<select>
|
703 |
+
<div class='mega-description'>
|
704 |
+
</div>
|
705 |
+
</td>
|
706 |
+
</tr>
|
707 |
+
<tr>
|
708 |
+
<td class='mega-name'>
|
709 |
+
<?php _e("Active Menu Instances", "megamenu"); ?>
|
710 |
+
<div class='mega-description'>
|
711 |
+
<?php _e("Some themes will output a menu location multiple times on the same page. For example, your theme may output a menu location once for the main menu, then again for the mobile menu. This setting can be used to make sure Max Mega Menu is only applied to one of those instances.", "megamenu"); ?>
|
712 |
+
</div>
|
713 |
+
</td>
|
714 |
+
<td class='mega-value mega-instances'>
|
715 |
+
<?php if (count($locations)): ?>
|
716 |
+
<table>
|
717 |
+
<tr>
|
718 |
+
<th><?php _e("Menu Location", "megamenu"); ?></th><th><?php _e("Active Instance", "megamenu"); ?></th>
|
719 |
+
</tr>
|
720 |
+
<?php foreach( $locations as $location => $description ): ?>
|
721 |
+
<?php if (max_mega_menu_is_enabled($location)): ?>
|
722 |
+
<?php $active_instance = isset($saved_settings['instances'][$location]) ? $saved_settings['instances'][$location] : 0; ?>
|
723 |
+
<tr>
|
724 |
+
<td><?php echo $description; ?></td><td><input type='text' name='settings[instances][<?php echo $location ?>]' value='<?php echo $active_instance; ?>' /></td>
|
725 |
+
</tr>
|
726 |
+
<?php endif; ?>
|
727 |
+
<?php endforeach; ?>
|
728 |
+
</table>
|
729 |
+
<div class='mega-description'><?php _e("0: Apply to all instances. 1: Apply to first instance", "megamenu"); ?></div>
|
730 |
+
<?php endif; ?>
|
731 |
+
</td>
|
732 |
+
</tr>
|
733 |
</table>
|
734 |
|
735 |
<?php do_action( "megamenu_general_settings", $saved_settings ); ?>
|
classes/style-manager.class.php
CHANGED
@@ -23,9 +23,7 @@ final class Mega_Menu_Style_Manager {
|
|
23 |
* @since 1.0
|
24 |
*/
|
25 |
public function __construct() {
|
26 |
-
|
27 |
$this->settings = get_option( "megamenu_settings" );
|
28 |
-
|
29 |
}
|
30 |
|
31 |
|
@@ -35,16 +33,11 @@ final class Mega_Menu_Style_Manager {
|
|
35 |
* @since 1.0
|
36 |
*/
|
37 |
public function setup_actions() {
|
38 |
-
|
39 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
40 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 999 );
|
41 |
add_action( 'wp_head', array( $this, 'head_css' ), 9999 );
|
42 |
-
|
43 |
add_action( 'megamenu_delete_cache', array( $this, 'delete_cache' ) );
|
44 |
add_action( 'after_switch_theme', array( $this, 'delete_cache') );
|
45 |
-
add_filter( 'megamenu_themes', array( $this, 'megamenu_add_theme_light') );
|
46 |
-
add_filter( 'megamenu_themes', array( $this, 'megamenu_add_theme_light_transparent') );
|
47 |
-
add_filter( 'megamenu_themes', array( $this, 'megamenu_add_theme_dark_transparent') );
|
48 |
|
49 |
// PolyLang
|
50 |
if ( function_exists( 'pll_current_language' ) ) {
|
@@ -56,7 +49,6 @@ final class Mega_Menu_Style_Manager {
|
|
56 |
add_filter( 'megamenu_css_filename', array( $this, 'wpml_css_filename') );
|
57 |
add_action( 'megamenu_after_delete_cache', array( $this, 'wpml_delete_cache') );
|
58 |
}
|
59 |
-
|
60 |
}
|
61 |
|
62 |
|
@@ -65,7 +57,7 @@ final class Mega_Menu_Style_Manager {
|
|
65 |
*/
|
66 |
public function get_default_theme() {
|
67 |
return apply_filters("megamenu_default_theme", array(
|
68 |
-
'title' => __("
|
69 |
'container_background_from' => '#222',
|
70 |
'container_background_to' => '#222',
|
71 |
'container_padding_left' => '0px',
|
@@ -266,7 +258,6 @@ final class Mega_Menu_Style_Manager {
|
|
266 |
}
|
267 |
|
268 |
|
269 |
-
|
270 |
/**
|
271 |
*
|
272 |
* @since 1.0
|
@@ -279,197 +270,6 @@ final class Mega_Menu_Style_Manager {
|
|
279 |
}
|
280 |
|
281 |
|
282 |
-
/**
|
283 |
-
* Add light transparent theme - light links on dark background
|
284 |
-
*
|
285 |
-
* @param array $themes
|
286 |
-
* @since 2.2.3
|
287 |
-
* @return array
|
288 |
-
*/
|
289 |
-
public function megamenu_add_theme_light_transparent( $themes ) {
|
290 |
-
$themes["default_light_transparent"] = array(
|
291 |
-
'title' => 'Light (Transparent)',
|
292 |
-
'container_background_from' => 'rgba(255, 255, 255, 0)',
|
293 |
-
'container_background_to' => 'rgba(255, 255, 255, 0)',
|
294 |
-
'menu_item_background_hover_from' => 'rgba(255, 255, 255, 0)',
|
295 |
-
'menu_item_background_hover_to' => 'rgba(255, 255, 255, 0)',
|
296 |
-
'menu_item_link_color' => 'rgb(250,250,250)',
|
297 |
-
'menu_item_link_color_hover' => 'rgb(255,255,255)',
|
298 |
-
'panel_background_from' => 'rgb(250, 250, 250)',
|
299 |
-
'panel_background_to' => 'rgb(248, 248, 248)',
|
300 |
-
'panel_header_text_transform' => 'none',
|
301 |
-
'panel_header_border_color' => '#555',
|
302 |
-
'panel_font_size' => '14px',
|
303 |
-
'panel_font_color' => '#666',
|
304 |
-
'panel_font_family' => 'inherit',
|
305 |
-
'panel_second_level_font_color' => 'rgb(102, 102, 102)',
|
306 |
-
'panel_second_level_font_color_hover' => 'rgb(34, 34, 34)',
|
307 |
-
'panel_second_level_text_transform' => 'none',
|
308 |
-
'panel_second_level_font' => 'inherit',
|
309 |
-
'panel_second_level_font_size' => '16px',
|
310 |
-
'panel_second_level_font_weight' => 'bold',
|
311 |
-
'panel_second_level_font_weight_hover' => 'bold',
|
312 |
-
'panel_second_level_text_decoration' => 'none',
|
313 |
-
'panel_second_level_text_decoration_hover' => 'none',
|
314 |
-
'panel_second_level_padding_bottom' => '5px',
|
315 |
-
'panel_second_level_border_color' => '#555',
|
316 |
-
'panel_third_level_font_color' => 'rgb(102, 102, 102)',
|
317 |
-
'panel_third_level_font_color_hover' => 'rgb(34, 34, 34)',
|
318 |
-
'panel_third_level_font' => 'inherit',
|
319 |
-
'panel_third_level_font_size' => '14px',
|
320 |
-
'flyout_width' => '175px',
|
321 |
-
'flyout_menu_background_from' => 'rgb(250, 250, 250)',
|
322 |
-
'flyout_menu_background_to' => 'rgb(250, 250, 250)',
|
323 |
-
'flyout_background_from' => 'rgba(255, 255, 255, 0)',
|
324 |
-
'flyout_background_to' => 'rgba(255, 255, 255, 0)',
|
325 |
-
'flyout_background_hover_from' => 'rgba(255, 255, 255, 0)',
|
326 |
-
'flyout_background_hover_to' => 'rgba(255, 255, 255, 0)',
|
327 |
-
'flyout_link_size' => '14px',
|
328 |
-
'flyout_link_color' => '#666',
|
329 |
-
'flyout_link_color_hover' => 'rgb(34, 34, 34)',
|
330 |
-
'flyout_link_family' => 'inherit',
|
331 |
-
'toggle_background_from' => '#222',
|
332 |
-
'toggle_background_to' => '#222',
|
333 |
-
'toggle_font_color' => 'rgb(85, 85, 85)',
|
334 |
-
'mobile_background_from' => 'rgb(255, 255, 255)',
|
335 |
-
'mobile_background_to' => 'rgb(255, 255, 255)',
|
336 |
-
'transitions' => 'on',
|
337 |
-
'custom_css' => '/** Push menu onto new line **/
|
338 |
-
#{$wrap} {
|
339 |
-
clear: both;
|
340 |
-
}'
|
341 |
-
);
|
342 |
-
return $themes;
|
343 |
-
}
|
344 |
-
|
345 |
-
|
346 |
-
/**
|
347 |
-
* Add Dark transparent - dark links on transparent background
|
348 |
-
*
|
349 |
-
* @param array $themes
|
350 |
-
* @since 2.2.3
|
351 |
-
* @return array
|
352 |
-
*/
|
353 |
-
public function megamenu_add_theme_dark_transparent( $themes ) {
|
354 |
-
$themes["default_dark_transparent"] = array(
|
355 |
-
'title' => 'Dark (Transparent)',
|
356 |
-
'container_background_from' => 'rgba(255, 255, 255, 0)',
|
357 |
-
'container_background_to' => 'rgba(255, 255, 255, 0)',
|
358 |
-
'menu_item_background_hover_from' => 'rgba(255, 255, 255, 0)',
|
359 |
-
'menu_item_background_hover_to' => 'rgba(255, 255, 255, 0)',
|
360 |
-
'menu_item_link_color' => 'rgb(85, 85, 85)',
|
361 |
-
'menu_item_link_color_hover' => 'rgb(34, 34, 34)',
|
362 |
-
'panel_background_from' => 'rgb(250, 250, 250)',
|
363 |
-
'panel_background_to' => 'rgb(248, 248, 248)',
|
364 |
-
'panel_header_text_transform' => 'none',
|
365 |
-
'panel_header_border_color' => '#555',
|
366 |
-
'panel_font_size' => '14px',
|
367 |
-
'panel_font_color' => '#666',
|
368 |
-
'panel_font_family' => 'inherit',
|
369 |
-
'panel_second_level_font_color' => 'rgb(102, 102, 102)',
|
370 |
-
'panel_second_level_font_color_hover' => 'rgb(34, 34, 34)',
|
371 |
-
'panel_second_level_text_transform' => 'none',
|
372 |
-
'panel_second_level_font' => 'inherit',
|
373 |
-
'panel_second_level_font_size' => '16px',
|
374 |
-
'panel_second_level_font_weight' => 'bold',
|
375 |
-
'panel_second_level_font_weight_hover' => 'bold',
|
376 |
-
'panel_second_level_text_decoration' => 'none',
|
377 |
-
'panel_second_level_text_decoration_hover' => 'none',
|
378 |
-
'panel_second_level_padding_bottom' => '5px',
|
379 |
-
'panel_second_level_border_color' => '#555',
|
380 |
-
'panel_third_level_font_color' => 'rgb(102, 102, 102)',
|
381 |
-
'panel_third_level_font_color_hover' => 'rgb(34, 34, 34)',
|
382 |
-
'panel_third_level_font' => 'inherit',
|
383 |
-
'panel_third_level_font_size' => '14px',
|
384 |
-
'flyout_width' => '175px',
|
385 |
-
'flyout_menu_background_from' => 'rgb(250, 250, 250)',
|
386 |
-
'flyout_menu_background_to' => 'rgb(250, 250, 250)',
|
387 |
-
'flyout_background_from' => 'rgba(255, 255, 255, 0)',
|
388 |
-
'flyout_background_to' => 'rgba(255, 255, 255, 0)',
|
389 |
-
'flyout_background_hover_from' => 'rgba(255, 255, 255, 0)',
|
390 |
-
'flyout_background_hover_to' => 'rgba(255, 255, 255, 0)',
|
391 |
-
'flyout_link_size' => '14px',
|
392 |
-
'flyout_link_color' => '#666',
|
393 |
-
'flyout_link_color_hover' => 'rgb(34, 34, 34)',
|
394 |
-
'flyout_link_family' => 'inherit',
|
395 |
-
'toggle_background_from' => '#222',
|
396 |
-
'toggle_background_to' => '#222',
|
397 |
-
'toggle_font_color' => 'rgb(85, 85, 85)',
|
398 |
-
'mobile_background_from' => 'rgb(255, 255, 255)',
|
399 |
-
'mobile_background_to' => 'rgb(255, 255, 255)',
|
400 |
-
'transitions' => 'on',
|
401 |
-
'custom_css' => '/** Push menu onto new line **/
|
402 |
-
#{$wrap} {
|
403 |
-
clear: both;
|
404 |
-
}'
|
405 |
-
);
|
406 |
-
return $themes;
|
407 |
-
}
|
408 |
-
|
409 |
-
/**
|
410 |
-
* Add light theme
|
411 |
-
*
|
412 |
-
* @param array $themes
|
413 |
-
* @since 2.2.3
|
414 |
-
* @return array
|
415 |
-
*/
|
416 |
-
public function megamenu_add_theme_light( $themes ) {
|
417 |
-
$themes["default_light"] = array(
|
418 |
-
'title' => 'Light',
|
419 |
-
'container_background_from' => 'rgb(255, 255, 255)',
|
420 |
-
'container_background_to' => 'rgb(255, 255, 255)',
|
421 |
-
'menu_item_background_hover_from' => 'rgba(255, 255, 255, 0)',
|
422 |
-
'menu_item_background_hover_to' => 'rgba(255, 255, 255, 0)',
|
423 |
-
'menu_item_link_color' => 'rgb(85, 85, 85)',
|
424 |
-
'menu_item_link_color_hover' => 'rgb(34, 34, 34)',
|
425 |
-
'panel_background_from' => 'rgb(250, 250, 250)',
|
426 |
-
'panel_background_to' => 'rgb(248, 248, 248)',
|
427 |
-
'panel_header_text_transform' => 'none',
|
428 |
-
'panel_header_border_color' => '#555',
|
429 |
-
'panel_font_size' => '14px',
|
430 |
-
'panel_font_color' => '#666',
|
431 |
-
'panel_font_family' => 'inherit',
|
432 |
-
'panel_second_level_font_color' => 'rgb(102, 102, 102)',
|
433 |
-
'panel_second_level_font_color_hover' => 'rgb(34, 34, 34)',
|
434 |
-
'panel_second_level_text_transform' => 'none',
|
435 |
-
'panel_second_level_font' => 'inherit',
|
436 |
-
'panel_second_level_font_size' => '16px',
|
437 |
-
'panel_second_level_font_weight' => 'bold',
|
438 |
-
'panel_second_level_font_weight_hover' => 'bold',
|
439 |
-
'panel_second_level_text_decoration' => 'none',
|
440 |
-
'panel_second_level_text_decoration_hover' => 'none',
|
441 |
-
'panel_second_level_padding_bottom' => '5px',
|
442 |
-
'panel_second_level_border_color' => '#555',
|
443 |
-
'panel_third_level_font_color' => 'rgb(102, 102, 102)',
|
444 |
-
'panel_third_level_font_color_hover' => 'rgb(34, 34, 34)',
|
445 |
-
'panel_third_level_font' => 'inherit',
|
446 |
-
'panel_third_level_font_size' => '14px',
|
447 |
-
'flyout_width' => '175px',
|
448 |
-
'flyout_menu_background_from' => 'rgb(250, 250, 250)',
|
449 |
-
'flyout_menu_background_to' => 'rgb(250, 250, 250)',
|
450 |
-
'flyout_background_from' => 'rgba(255, 255, 255, 0)',
|
451 |
-
'flyout_background_to' => 'rgba(255, 255, 255, 0)',
|
452 |
-
'flyout_background_hover_from' => 'rgba(255, 255, 255, 0)',
|
453 |
-
'flyout_background_hover_to' => 'rgba(255, 255, 255, 0)',
|
454 |
-
'flyout_link_size' => '14px',
|
455 |
-
'flyout_link_color' => '#666',
|
456 |
-
'flyout_link_color_hover' => 'rgb(34, 34, 34)',
|
457 |
-
'flyout_link_family' => 'inherit',
|
458 |
-
'toggle_background_from' => '#222',
|
459 |
-
'toggle_background_to' => '#222',
|
460 |
-
'toggle_font_color' => 'rgb(85, 85, 85)',
|
461 |
-
'mobile_background_from' => 'rgb(255, 255, 255)',
|
462 |
-
'mobile_background_to' => 'rgb(255, 255, 255)',
|
463 |
-
'transitions' => 'on',
|
464 |
-
'custom_css' => '/** Push menu onto new line **/
|
465 |
-
#{$wrap} {
|
466 |
-
clear: both;
|
467 |
-
}'
|
468 |
-
);
|
469 |
-
return $themes;
|
470 |
-
}
|
471 |
-
|
472 |
-
|
473 |
/**
|
474 |
* Merge the saved themes (from options table) into array of complete themes
|
475 |
*
|
@@ -979,21 +779,13 @@ final class Mega_Menu_Style_Manager {
|
|
979 |
public function enqueue_scripts() {
|
980 |
|
981 |
wp_enqueue_script( 'hoverIntent' );
|
982 |
-
|
|
|
|
|
|
|
983 |
|
984 |
$params = apply_filters("megamenu_javascript_localisation",
|
985 |
array(
|
986 |
-
"effect" => array(
|
987 |
-
"slide" => array(
|
988 |
-
"in" => array(
|
989 |
-
"animate" => array("height" => "show"),
|
990 |
-
"css" => array("display" => "none")
|
991 |
-
),
|
992 |
-
"out" => array(
|
993 |
-
"animate" => array("height" => "hide")
|
994 |
-
)
|
995 |
-
)
|
996 |
-
),
|
997 |
"timeout" => 300,
|
998 |
"interval" => 100
|
999 |
)
|
23 |
* @since 1.0
|
24 |
*/
|
25 |
public function __construct() {
|
|
|
26 |
$this->settings = get_option( "megamenu_settings" );
|
|
|
27 |
}
|
28 |
|
29 |
|
33 |
* @since 1.0
|
34 |
*/
|
35 |
public function setup_actions() {
|
|
|
36 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
37 |
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 999 );
|
38 |
add_action( 'wp_head', array( $this, 'head_css' ), 9999 );
|
|
|
39 |
add_action( 'megamenu_delete_cache', array( $this, 'delete_cache' ) );
|
40 |
add_action( 'after_switch_theme', array( $this, 'delete_cache') );
|
|
|
|
|
|
|
41 |
|
42 |
// PolyLang
|
43 |
if ( function_exists( 'pll_current_language' ) ) {
|
49 |
add_filter( 'megamenu_css_filename', array( $this, 'wpml_css_filename') );
|
50 |
add_action( 'megamenu_after_delete_cache', array( $this, 'wpml_delete_cache') );
|
51 |
}
|
|
|
52 |
}
|
53 |
|
54 |
|
57 |
*/
|
58 |
public function get_default_theme() {
|
59 |
return apply_filters("megamenu_default_theme", array(
|
60 |
+
'title' => __("Default", "megamenu"),
|
61 |
'container_background_from' => '#222',
|
62 |
'container_background_to' => '#222',
|
63 |
'container_padding_left' => '0px',
|
258 |
}
|
259 |
|
260 |
|
|
|
261 |
/**
|
262 |
*
|
263 |
* @since 1.0
|
270 |
}
|
271 |
|
272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
/**
|
274 |
* Merge the saved themes (from options table) into array of complete themes
|
275 |
*
|
779 |
public function enqueue_scripts() {
|
780 |
|
781 |
wp_enqueue_script( 'hoverIntent' );
|
782 |
+
|
783 |
+
$js_path = MEGAMENU_BASE_URL . "js/maxmegamenu.js";
|
784 |
+
|
785 |
+
wp_enqueue_script( 'megamenu', $js_path, array('jquery', 'hoverIntent'), MEGAMENU_VERSION, true );
|
786 |
|
787 |
$params = apply_filters("megamenu_javascript_localisation",
|
788 |
array(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
"timeout" => 300,
|
790 |
"interval" => 100
|
791 |
)
|
classes/walker.class.php
CHANGED
@@ -116,6 +116,11 @@ class Mega_Menu_Walker extends Walker_Nav_Menu {
|
|
116 |
$atts['class'] = 'mega-menu-link';
|
117 |
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
119 |
if ( $depth == 0 ) {
|
120 |
$atts['tabindex'] = "0";
|
121 |
}
|
@@ -136,7 +141,9 @@ class Mega_Menu_Walker extends Walker_Nav_Menu {
|
|
136 |
|
137 |
if ( $settings['hide_text'] == 'true' ) {
|
138 |
/** This filter is documented in wp-includes/post-template.php */
|
139 |
-
} else {
|
|
|
|
|
140 |
$item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after;
|
141 |
}
|
142 |
|
116 |
$atts['class'] = 'mega-menu-link';
|
117 |
}
|
118 |
|
119 |
+
// required for Surface/Win10/Edge
|
120 |
+
if ( in_array('menu-item-has-children', $classes ) ) {
|
121 |
+
$atts['aria-haspopup'] = "true";
|
122 |
+
}
|
123 |
+
|
124 |
if ( $depth == 0 ) {
|
125 |
$atts['tabindex'] = "0";
|
126 |
}
|
141 |
|
142 |
if ( $settings['hide_text'] == 'true' ) {
|
143 |
/** This filter is documented in wp-includes/post-template.php */
|
144 |
+
} else if ( property_exists( $item, 'mega_description' ) && strlen( $item->mega_description ) ) {
|
145 |
+
$item_output .= '<span class="mega-description-group"><span class="mega-menu-title">' . $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after . '</span><span class="mega-menu-description">' . $item->description . '</span></span>';
|
146 |
+
} else {
|
147 |
$item_output .= $args->link_before . apply_filters( 'megamenu_the_title', $item->title, $item->ID ) . $args->link_after;
|
148 |
}
|
149 |
|
css/admin/menus.css
CHANGED
@@ -815,6 +815,7 @@
|
|
815 |
color: #999;
|
816 |
font-size: 14px;
|
817 |
font-weight: normal;
|
|
|
818 |
}
|
819 |
|
820 |
.mega_menu_meta_box div#megamenu_accordion h3.ui-state-active,
|
@@ -850,8 +851,9 @@
|
|
850 |
}
|
851 |
|
852 |
.mega_menu_meta_box div.accordion_content {
|
853 |
-
padding
|
854 |
float: left;
|
|
|
855 |
width: 100%;
|
856 |
}
|
857 |
.mega_menu_meta_box div table {
|
815 |
color: #999;
|
816 |
font-size: 14px;
|
817 |
font-weight: normal;
|
818 |
+
border: 0;
|
819 |
}
|
820 |
|
821 |
.mega_menu_meta_box div#megamenu_accordion h3.ui-state-active,
|
851 |
}
|
852 |
|
853 |
.mega_menu_meta_box div.accordion_content {
|
854 |
+
padding: 0 0 20px 0;
|
855 |
float: left;
|
856 |
+
border: 0;
|
857 |
width: 100%;
|
858 |
}
|
859 |
.mega_menu_meta_box div table {
|
css/admin/settings.css
CHANGED
@@ -186,7 +186,7 @@ body[class*='mega-menu_page_maxmegamenu_'] .menu_settings h3 {
|
|
186 |
border-top: 1px solid #efefef;
|
187 |
}
|
188 |
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-name {
|
189 |
-
width:
|
190 |
line-height: 2em;
|
191 |
padding-right: 30px;
|
192 |
vertical-align: top;
|
@@ -194,6 +194,17 @@ body[class*='mega-menu_page_maxmegamenu_'] .menu_settings h3 {
|
|
194 |
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value {
|
195 |
padding-top: 10px;
|
196 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-name .mega-description,
|
198 |
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value .mega-description {
|
199 |
font-size: 0.9em;
|
186 |
border-top: 1px solid #efefef;
|
187 |
}
|
188 |
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-name {
|
189 |
+
width: 33%;
|
190 |
line-height: 2em;
|
191 |
padding-right: 30px;
|
192 |
vertical-align: top;
|
194 |
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value {
|
195 |
padding-top: 10px;
|
196 |
}
|
197 |
+
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value.mega-instances {
|
198 |
+
vertical-align: top;
|
199 |
+
}
|
200 |
+
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value.mega-instances table th,
|
201 |
+
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value.mega-instances table td {
|
202 |
+
font-weight: normal;
|
203 |
+
padding: 5px;
|
204 |
+
}
|
205 |
+
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value.mega-instances .mega-description {
|
206 |
+
padding-left: 5px;
|
207 |
+
}
|
208 |
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-name .mega-description,
|
209 |
.megamenu_outer_wrap .megamenu_right .menu_settings td.mega-value .mega-description {
|
210 |
font-size: 0.9em;
|
css/megamenu.scss
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
// ****** This file will be overwritten each time the plugin is updated *******
|
3 |
//
|
4 |
// This file is a major component of Max Mega Menu. The styling below works in
|
5 |
-
// perfect harmony with the current version of the
|
6 |
// will change as features are added to the plugin. Likewise, this CSS will be
|
7 |
// updated as new features are added to Max Mega Menu.
|
8 |
//
|
@@ -86,6 +86,24 @@
|
|
86 |
-o-transition: background 200ms linear, color 200ms linear;
|
87 |
transition: background 200ms linear, color 200ms linear;
|
88 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
li.mega-disable-link > a.mega-menu-link {
|
@@ -117,18 +135,13 @@
|
|
117 |
opacity: 1;
|
118 |
}
|
119 |
|
120 |
-
li.mega-menu-item.mega-animating > ul.mega-sub-menu {
|
121 |
-
visibility: visible;
|
122 |
-
pointer-events: none;
|
123 |
-
}
|
124 |
-
|
125 |
&[data-effect="fade"] {
|
126 |
|
127 |
li.mega-menu-item > ul.mega-sub-menu {
|
128 |
opacity: 0;
|
129 |
transition-duration: $effect_speed;
|
130 |
transition-timing-function: ease-in;
|
131 |
-
transition-property: opacity;
|
132 |
}
|
133 |
|
134 |
&.mega-no-js li.mega-menu-item:hover > ul.mega-sub-menu,
|
@@ -148,7 +161,7 @@
|
|
148 |
margin-top: 10px;
|
149 |
transition-duration: $effect_speed;
|
150 |
transition-timing-function: ease-in;
|
151 |
-
transition-property: opacity, margin-top;
|
152 |
}
|
153 |
|
154 |
&.mega-no-js li.mega-menu-item:hover > ul.mega-sub-menu,
|
@@ -168,7 +181,7 @@
|
|
168 |
margin-top: 10px;
|
169 |
transition-duration: $effect_speed;
|
170 |
transition-timing-function: ease-in;
|
171 |
-
transition-property: margin-top;
|
172 |
}
|
173 |
|
174 |
&.mega-no-js li.mega-menu-item:hover > ul.mega-sub-menu,
|
@@ -190,6 +203,7 @@
|
|
190 |
|
191 |
li.mega-menu-item.mega-menu-megamenu ul.mega-sub-menu ul.mega-sub-menu {
|
192 |
visibility: inherit;
|
|
|
193 |
}
|
194 |
|
195 |
li.mega-menu-item a[class^='dashicons']:before {
|
@@ -248,6 +262,7 @@
|
|
248 |
margin: 0 $menu_item_spacing 0 0;
|
249 |
display: inline-block;
|
250 |
height: auto;
|
|
|
251 |
|
252 |
@if $menu_item_divider == 'on' {
|
253 |
border-left: 1px solid $menu_item_divider_color;
|
@@ -318,6 +333,20 @@
|
|
318 |
font-size: $menu_item_link_font_size;
|
319 |
}
|
320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
@include mobile {
|
322 |
display: list-item;
|
323 |
margin: 0;
|
@@ -342,7 +371,6 @@
|
|
342 |
}
|
343 |
|
344 |
// sub menu items (megamenu)
|
345 |
-
|
346 |
> li.mega-menu-megamenu > ul.mega-sub-menu {
|
347 |
z-index: $z_index;
|
348 |
@include border-radius($panel_border_radius_top_left, $panel_border_radius_top_right, $panel_border_radius_bottom_right, $panel_border_radius_bottom_left);
|
@@ -371,7 +399,7 @@
|
|
371 |
@include mobile {
|
372 |
float: left;
|
373 |
position: static;
|
374 |
-
width: 100
|
375 |
}
|
376 |
|
377 |
@include desktop {
|
@@ -384,6 +412,10 @@
|
|
384 |
}
|
385 |
}
|
386 |
|
|
|
|
|
|
|
|
|
387 |
> li.mega-menu-item ul.mega-sub-menu {
|
388 |
clear: both;
|
389 |
|
@@ -410,7 +442,7 @@
|
|
410 |
clear: left;
|
411 |
}
|
412 |
|
413 |
-
|
414 |
h4.mega-block-title {
|
415 |
color: $panel_header_color;
|
416 |
font-family: $panel_header_font;
|
@@ -428,7 +460,7 @@
|
|
428 |
border-bottom: $panel_header_border_bottom solid $panel_header_border_color;
|
429 |
}
|
430 |
|
431 |
-
|
432 |
> a.mega-menu-link {
|
433 |
color: $panel_second_level_font_color;
|
434 |
font-family: $panel_second_level_font;
|
@@ -446,7 +478,7 @@
|
|
446 |
border-bottom: $panel_second_level_border_bottom solid $panel_second_level_border_color;
|
447 |
}
|
448 |
|
449 |
-
|
450 |
> a.mega-menu-link:hover,
|
451 |
> a.mega-menu-link:focus {
|
452 |
color: $panel_second_level_font_color_hover;
|
@@ -455,7 +487,7 @@
|
|
455 |
@include background($panel_second_level_background_hover_from, $panel_second_level_background_hover_to);
|
456 |
}
|
457 |
|
458 |
-
|
459 |
li.mega-menu-item > a.mega-menu-link {
|
460 |
color: $panel_third_level_font_color;
|
461 |
font-family: $panel_third_level_font;
|
@@ -469,7 +501,7 @@
|
|
469 |
display: block;
|
470 |
}
|
471 |
|
472 |
-
|
473 |
li.mega-menu-item > a.mega-menu-link:hover,
|
474 |
li.mega-menu-item > a.mega-menu-link:focus {
|
475 |
color: $panel_third_level_font_color_hover;
|
@@ -501,8 +533,7 @@
|
|
501 |
}
|
502 |
}
|
503 |
|
504 |
-
//
|
505 |
-
|
506 |
> li.mega-menu-flyout ul.mega-sub-menu {
|
507 |
z-index: $z_index;
|
508 |
position: absolute;
|
@@ -521,7 +552,7 @@
|
|
521 |
@include mobile {
|
522 |
float: left;
|
523 |
position: static;
|
524 |
-
width: 100
|
525 |
padding: 0;
|
526 |
border: 0;
|
527 |
}
|
@@ -556,7 +587,7 @@
|
|
556 |
vertical-align: baseline;
|
557 |
}
|
558 |
|
559 |
-
&:first-child a.mega-menu-link {
|
560 |
border-top-left-radius: $flyout_border_radius_top_left;
|
561 |
border-top-right-radius: $flyout_border_radius_top_right;
|
562 |
|
@@ -566,7 +597,7 @@
|
|
566 |
}
|
567 |
}
|
568 |
|
569 |
-
&:last-child a.mega-menu-link {
|
570 |
border-bottom-right-radius: $flyout_border_radius_bottom_right;
|
571 |
border-bottom-left-radius: $flyout_border_radius_bottom_left;
|
572 |
|
@@ -604,7 +635,7 @@
|
|
604 |
}
|
605 |
}
|
606 |
|
607 |
-
//
|
608 |
li.mega-menu-flyout.mega-menu-item-has-children,
|
609 |
li.mega-menu-flyout li.mega-menu-item-has-children,
|
610 |
> li.mega-menu-item-has-children {
|
@@ -640,7 +671,7 @@
|
|
640 |
}
|
641 |
}
|
642 |
|
643 |
-
// arrows
|
644 |
li.mega-menu-flyout.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after,
|
645 |
li.mega-menu-flyout li.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after,
|
646 |
> li.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after {
|
@@ -658,6 +689,7 @@
|
|
658 |
}
|
659 |
}
|
660 |
|
|
|
661 |
li.mega-menu-flyout.mega-align-bottom-right {
|
662 |
|
663 |
li.mega-menu-item a.mega-menu-link {
|
@@ -695,7 +727,7 @@
|
|
695 |
}
|
696 |
}
|
697 |
|
698 |
-
//
|
699 |
li[class^='mega-lang-item'] > a.mega-menu-link > img {
|
700 |
display: inline;
|
701 |
}
|
2 |
// ****** This file will be overwritten each time the plugin is updated *******
|
3 |
//
|
4 |
// This file is a major component of Max Mega Menu. The styling below works in
|
5 |
+
// perfect harmony with the current version of the plugin. The menu HTML
|
6 |
// will change as features are added to the plugin. Likewise, this CSS will be
|
7 |
// updated as new features are added to Max Mega Menu.
|
8 |
//
|
86 |
-o-transition: background 200ms linear, color 200ms linear;
|
87 |
transition: background 200ms linear, color 200ms linear;
|
88 |
}
|
89 |
+
|
90 |
+
.mega-description-group {
|
91 |
+
vertical-align: middle;
|
92 |
+
display: inline-block;
|
93 |
+
|
94 |
+
.mega-menu-title,
|
95 |
+
.mega-menu-description {
|
96 |
+
line-height: 1.5;
|
97 |
+
display: block;
|
98 |
+
}
|
99 |
+
|
100 |
+
.mega-menu-description {
|
101 |
+
font-style: italic;
|
102 |
+
font-size: 0.8em;
|
103 |
+
text-transform: none;
|
104 |
+
font-weight: normal;
|
105 |
+
}
|
106 |
+
}
|
107 |
}
|
108 |
|
109 |
li.mega-disable-link > a.mega-menu-link {
|
135 |
opacity: 1;
|
136 |
}
|
137 |
|
|
|
|
|
|
|
|
|
|
|
138 |
&[data-effect="fade"] {
|
139 |
|
140 |
li.mega-menu-item > ul.mega-sub-menu {
|
141 |
opacity: 0;
|
142 |
transition-duration: $effect_speed;
|
143 |
transition-timing-function: ease-in;
|
144 |
+
transition-property: opacity, visibility;
|
145 |
}
|
146 |
|
147 |
&.mega-no-js li.mega-menu-item:hover > ul.mega-sub-menu,
|
161 |
margin-top: 10px;
|
162 |
transition-duration: $effect_speed;
|
163 |
transition-timing-function: ease-in;
|
164 |
+
transition-property: opacity, margin-top, visibility;
|
165 |
}
|
166 |
|
167 |
&.mega-no-js li.mega-menu-item:hover > ul.mega-sub-menu,
|
181 |
margin-top: 10px;
|
182 |
transition-duration: $effect_speed;
|
183 |
transition-timing-function: ease-in;
|
184 |
+
transition-property: margin-top, visibility;
|
185 |
}
|
186 |
|
187 |
&.mega-no-js li.mega-menu-item:hover > ul.mega-sub-menu,
|
203 |
|
204 |
li.mega-menu-item.mega-menu-megamenu ul.mega-sub-menu ul.mega-sub-menu {
|
205 |
visibility: inherit;
|
206 |
+
opacity: 1;
|
207 |
}
|
208 |
|
209 |
li.mega-menu-item a[class^='dashicons']:before {
|
262 |
margin: 0 $menu_item_spacing 0 0;
|
263 |
display: inline-block;
|
264 |
height: auto;
|
265 |
+
vertical-align: middle;
|
266 |
|
267 |
@if $menu_item_divider == 'on' {
|
268 |
border-left: 1px solid $menu_item_divider_color;
|
333 |
font-size: $menu_item_link_font_size;
|
334 |
}
|
335 |
|
336 |
+
// support for multi line links
|
337 |
+
&.mega-multi-line > a.mega-menu-link {
|
338 |
+
@include desktop {
|
339 |
+
line-height: inherit;
|
340 |
+
display: table-cell;
|
341 |
+
vertical-align: middle;
|
342 |
+
}
|
343 |
+
@include mobile {
|
344 |
+
br {
|
345 |
+
display: none;
|
346 |
+
}
|
347 |
+
}
|
348 |
+
}
|
349 |
+
|
350 |
@include mobile {
|
351 |
display: list-item;
|
352 |
margin: 0;
|
371 |
}
|
372 |
|
373 |
// sub menu items (megamenu)
|
|
|
374 |
> li.mega-menu-megamenu > ul.mega-sub-menu {
|
375 |
z-index: $z_index;
|
376 |
@include border-radius($panel_border_radius_top_left, $panel_border_radius_top_right, $panel_border_radius_bottom_right, $panel_border_radius_bottom_left);
|
399 |
@include mobile {
|
400 |
float: left;
|
401 |
position: static;
|
402 |
+
width: 100%;
|
403 |
}
|
404 |
|
405 |
@include desktop {
|
412 |
}
|
413 |
}
|
414 |
|
415 |
+
.mega-description-group .mega-menu-description {
|
416 |
+
margin: 5px 0;
|
417 |
+
}
|
418 |
+
|
419 |
> li.mega-menu-item ul.mega-sub-menu {
|
420 |
clear: both;
|
421 |
|
442 |
clear: left;
|
443 |
}
|
444 |
|
445 |
+
// Widget titles
|
446 |
h4.mega-block-title {
|
447 |
color: $panel_header_color;
|
448 |
font-family: $panel_header_font;
|
460 |
border-bottom: $panel_header_border_bottom solid $panel_header_border_color;
|
461 |
}
|
462 |
|
463 |
+
// Second level menu items
|
464 |
> a.mega-menu-link {
|
465 |
color: $panel_second_level_font_color;
|
466 |
font-family: $panel_second_level_font;
|
478 |
border-bottom: $panel_second_level_border_bottom solid $panel_second_level_border_color;
|
479 |
}
|
480 |
|
481 |
+
// Second level menu item hover
|
482 |
> a.mega-menu-link:hover,
|
483 |
> a.mega-menu-link:focus {
|
484 |
color: $panel_second_level_font_color_hover;
|
487 |
@include background($panel_second_level_background_hover_from, $panel_second_level_background_hover_to);
|
488 |
}
|
489 |
|
490 |
+
// Third level menu items
|
491 |
li.mega-menu-item > a.mega-menu-link {
|
492 |
color: $panel_third_level_font_color;
|
493 |
font-family: $panel_third_level_font;
|
501 |
display: block;
|
502 |
}
|
503 |
|
504 |
+
// Third level menu items hover
|
505 |
li.mega-menu-item > a.mega-menu-link:hover,
|
506 |
li.mega-menu-item > a.mega-menu-link:focus {
|
507 |
color: $panel_third_level_font_color_hover;
|
533 |
}
|
534 |
}
|
535 |
|
536 |
+
// Sub menu items (flyout)
|
|
|
537 |
> li.mega-menu-flyout ul.mega-sub-menu {
|
538 |
z-index: $z_index;
|
539 |
position: absolute;
|
552 |
@include mobile {
|
553 |
float: left;
|
554 |
position: static;
|
555 |
+
width: 100%;
|
556 |
padding: 0;
|
557 |
border: 0;
|
558 |
}
|
587 |
vertical-align: baseline;
|
588 |
}
|
589 |
|
590 |
+
&:first-child > a.mega-menu-link {
|
591 |
border-top-left-radius: $flyout_border_radius_top_left;
|
592 |
border-top-right-radius: $flyout_border_radius_top_right;
|
593 |
|
597 |
}
|
598 |
}
|
599 |
|
600 |
+
&:last-child > a.mega-menu-link {
|
601 |
border-bottom-right-radius: $flyout_border_radius_bottom_right;
|
602 |
border-bottom-left-radius: $flyout_border_radius_bottom_left;
|
603 |
|
635 |
}
|
636 |
}
|
637 |
|
638 |
+
// Arrows
|
639 |
li.mega-menu-flyout.mega-menu-item-has-children,
|
640 |
li.mega-menu-flyout li.mega-menu-item-has-children,
|
641 |
> li.mega-menu-item-has-children {
|
671 |
}
|
672 |
}
|
673 |
|
674 |
+
// Hide arrows
|
675 |
li.mega-menu-flyout.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after,
|
676 |
li.mega-menu-flyout li.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after,
|
677 |
> li.mega-menu-item-has-children.mega-hide-arrow > a.mega-menu-link:after {
|
689 |
}
|
690 |
}
|
691 |
|
692 |
+
// Right aligned flyout menus
|
693 |
li.mega-menu-flyout.mega-align-bottom-right {
|
694 |
|
695 |
li.mega-menu-item a.mega-menu-link {
|
727 |
}
|
728 |
}
|
729 |
|
730 |
+
// PolyLang Language Switcher
|
731 |
li[class^='mega-lang-item'] > a.mega-menu-link > img {
|
732 |
display: inline;
|
733 |
}
|
js/maxmegamenu.js
CHANGED
@@ -1,15 +1,11 @@
|
|
1 |
/*jslint browser: true, white: true, this: true */
|
2 |
/*global console,jQuery,megamenu,window,navigator*/
|
3 |
|
4 |
-
|
5 |
-
* Max Mega Menu jQuery Plugin
|
6 |
-
*/
|
7 |
(function($) {
|
8 |
-
|
9 |
"use strict";
|
10 |
|
11 |
$.maxmegamenu = function(menu, options) {
|
12 |
-
|
13 |
var plugin = this;
|
14 |
var $menu = $(menu);
|
15 |
|
@@ -21,73 +17,33 @@
|
|
21 |
panel_inner_width: $menu.attr("data-panel-inner-width"),
|
22 |
second_click: $menu.attr("data-second-click"),
|
23 |
vertical_behaviour: $menu.attr("data-vertical-behaviour"),
|
24 |
-
reverse_mobile_items: $menu.attr("data-reverse-mobile-items"),
|
25 |
document_click: $menu.attr("data-document-click"),
|
26 |
breakpoint: $menu.attr("data-breakpoint")
|
27 |
};
|
28 |
|
29 |
plugin.settings = {};
|
30 |
|
31 |
-
|
32 |
/**
|
33 |
* Hides a single panel (sub menu)
|
34 |
*/
|
35 |
plugin.hidePanel = function(anchor, immediate) {
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
anchor.siblings(".mega-sub-menu").removeClass("mega-toggle-on");
|
40 |
-
anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
|
41 |
-
return;
|
42 |
-
}
|
43 |
-
|
44 |
-
if ( megamenu.effect[plugin.settings.effect] ) {
|
45 |
-
var effect = megamenu.effect[plugin.settings.effect]["out"];
|
46 |
-
var speed = plugin.settings.effect_speed;
|
47 |
-
|
48 |
-
if (effect.css) {
|
49 |
-
anchor.siblings(".mega-sub-menu").css(effect.css);
|
50 |
-
}
|
51 |
-
|
52 |
-
if (effect.animate) {
|
53 |
-
anchor.siblings(".mega-sub-menu").animate(effect.animate, speed, function() {
|
54 |
-
anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
|
55 |
-
});
|
56 |
-
|
57 |
-
anchor.siblings(".mega-sub-menu").each( function() {
|
58 |
-
plugin.addAnimatingClass(anchor.parent());
|
59 |
-
});
|
60 |
-
} else {
|
61 |
anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
|
62 |
-
|
63 |
-
}
|
64 |
-
} else {
|
65 |
-
anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
|
66 |
-
plugin.addAnimatingClass(anchor.parent());
|
67 |
-
}
|
68 |
-
|
69 |
-
};
|
70 |
-
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Adds an animating class to the sub menu whilst it is closing.
|
74 |
-
* This allows the CSS3 animation to complete before the element is hidden.
|
75 |
-
*/
|
76 |
-
plugin.addAnimatingClass = function(element) {
|
77 |
-
if (plugin.settings.effect === "disabled") {
|
78 |
return;
|
79 |
}
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
84 |
|
85 |
-
|
86 |
-
element.removeClass("mega-animating");
|
87 |
-
}, timeout );
|
88 |
};
|
89 |
|
90 |
-
|
91 |
/**
|
92 |
* Hide all open sub menus
|
93 |
*/
|
@@ -97,74 +53,50 @@
|
|
97 |
});
|
98 |
};
|
99 |
|
100 |
-
|
101 |
/**
|
102 |
* For flyout menus: Hide open sub menus at the same level as the sub menu that"s being opened
|
103 |
*/
|
104 |
plugin.hideSiblingPanels = function(anchor, immediate) {
|
105 |
// jQuery 1.7.2 compatibility for themes/plugins that load old versions of jQuery
|
106 |
if ($.fn.addBack !== undefined) {
|
107 |
-
// all open children of open siblings
|
108 |
-
anchor.parent().siblings().find(".mega-toggle-on").addBack().children("a").each(function() {
|
109 |
plugin.hidePanel($(this), immediate);
|
110 |
});
|
111 |
} else {
|
112 |
-
// all open children of open siblings
|
113 |
-
anchor.parent().siblings().find(".mega-toggle-on").andSelf().children("a").each(function() {
|
114 |
plugin.hidePanel($(this), immediate);
|
115 |
});
|
116 |
}
|
117 |
};
|
118 |
|
119 |
-
|
120 |
/**
|
121 |
* Returns true if the browser width is wider than the Responsive Breakpoint (set in Menu Theme Editor)
|
122 |
-
*
|
123 |
*/
|
124 |
plugin.isDesktopView = function() {
|
125 |
-
return $(window).width()
|
126 |
};
|
127 |
|
128 |
-
|
129 |
/**
|
130 |
-
*
|
131 |
-
* should be closed.
|
132 |
*/
|
133 |
-
plugin.
|
134 |
-
|
135 |
-
if (plugin.isDesktopView() && ($menu.hasClass("mega-menu-horizontal") || $menu.hasClass("mega-menu-vertical"))) {
|
136 |
-
return "immediately";
|
137 |
-
}
|
138 |
-
|
139 |
-
// mobile, keyboard navigation
|
140 |
-
if (!plugin.isDesktopView() && $menu.hasClass("mega-keyboard-navigation")) {
|
141 |
-
return "animated";
|
142 |
-
}
|
143 |
-
|
144 |
-
if (plugin.settings.vertical_behaviour === "accordion") {
|
145 |
-
return "animated";
|
146 |
-
}
|
147 |
-
|
148 |
-
return false;
|
149 |
};
|
150 |
|
151 |
-
|
152 |
/**
|
153 |
* Display a single panel. Also handles closing of panels that are currently open and need to be closed.
|
154 |
*/
|
155 |
plugin.showPanel = function(anchor) {
|
156 |
-
if (
|
157 |
return;
|
158 |
}
|
159 |
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
plugin.hideSiblingPanels(anchor, false);
|
167 |
-
break;
|
168 |
}
|
169 |
|
170 |
// apply dynamic width and sub menu position
|
@@ -201,43 +133,40 @@
|
|
201 |
}
|
202 |
|
203 |
// apply jQuery transition (only if the effect is set to "slide", other transitions are CSS based)
|
204 |
-
if (
|
205 |
-
|
206 |
-
var speed = plugin.settings.effect_speed;
|
207 |
-
|
208 |
-
if (effect.css) {
|
209 |
-
anchor.siblings(".mega-sub-menu").css(effect.css);
|
210 |
-
}
|
211 |
-
|
212 |
-
if (effect.animate) {
|
213 |
-
anchor.siblings(".mega-sub-menu").animate(effect.animate, speed, "swing", function() {
|
214 |
-
$(this).css("display", "");
|
215 |
-
});
|
216 |
-
}
|
217 |
}
|
218 |
|
219 |
anchor.parent().addClass("mega-toggle-on").triggerHandler("open_panel");
|
220 |
};
|
221 |
|
222 |
-
|
223 |
/**
|
224 |
* Open sub menus on click
|
225 |
*/
|
226 |
var bindClickEvents = function() {
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
plugin.hideAllPanels();
|
231 |
}
|
|
|
232 |
});
|
233 |
|
234 |
var items_with_submenus = $("li.mega-menu-megamenu.mega-menu-item-has-children > a.mega-menu-link, li.mega-menu-flyout.mega-menu-item-has-children > a.mega-menu-link, li.mega-menu-flyout li.mega-menu-item-has-children > a.mega-menu-link", menu);
|
235 |
|
236 |
-
items_with_submenus.on("click.megamenu
|
237 |
-
|
238 |
-
if (!plugin.isDesktopView() && $(this).parent().hasClass("mega-hide-sub-menu-on-mobile")) {
|
239 |
return;
|
240 |
}
|
|
|
|
|
|
|
241 |
|
242 |
// check for second click
|
243 |
if (plugin.settings.second_click === "go" || $(this).parent().hasClass("mega-click-click-go")) {
|
@@ -257,16 +186,12 @@
|
|
257 |
});
|
258 |
};
|
259 |
|
260 |
-
|
261 |
/**
|
262 |
* Open sub menus on hover
|
263 |
*/
|
264 |
var bindHoverEvents = function() {
|
265 |
$("li.mega-menu-item-has-children", menu).not("li.mega-menu-megamenu li.mega-menu-item-has-children", menu).on({
|
266 |
mouseenter: function() {
|
267 |
-
if ($(this).hasClass('mega-animating')) {
|
268 |
-
return;
|
269 |
-
}
|
270 |
plugin.unbindClickEvents();
|
271 |
plugin.showPanel($(this).children("a"));
|
272 |
},
|
@@ -278,16 +203,12 @@
|
|
278 |
});
|
279 |
};
|
280 |
|
281 |
-
|
282 |
/**
|
283 |
* Open sub menus on hoverIntent
|
284 |
*/
|
285 |
var bindHoverIntentEvents = function() {
|
286 |
$("li.mega-menu-item-has-children", menu).not("li.mega-menu-megamenu li.mega-menu-item-has-children", menu).hoverIntent({
|
287 |
over: function () {
|
288 |
-
if ($(this).hasClass('mega-animating')) {
|
289 |
-
return;
|
290 |
-
}
|
291 |
plugin.unbindClickEvents();
|
292 |
plugin.showPanel($(this).children("a"));
|
293 |
},
|
@@ -301,13 +222,12 @@
|
|
301 |
});
|
302 |
};
|
303 |
|
304 |
-
|
305 |
/**
|
306 |
*
|
307 |
*/
|
308 |
plugin.unbindClickEvents = function() {
|
309 |
-
$("a.mega-menu-link").off("click.megamenu
|
310 |
-
}
|
311 |
|
312 |
/**
|
313 |
* Handle keyboard navigation of the menu. Highlight focused items.
|
@@ -337,11 +257,9 @@
|
|
337 |
if (keyCode === tab_key) {
|
338 |
$menu.addClass("mega-keyboard-navigation");
|
339 |
|
340 |
-
if ( active_link.parent().hasClass("mega-menu-item-has-children") ) {
|
341 |
-
// menu item with sub menu
|
342 |
plugin.showPanel(active_link);
|
343 |
-
} else if ( active_link.parent().parent().hasClass("mega-menu") ) {
|
344 |
-
// top level item with no children
|
345 |
plugin.hideAllPanels();
|
346 |
}
|
347 |
|
@@ -352,36 +270,29 @@
|
|
352 |
});
|
353 |
};
|
354 |
|
355 |
-
|
356 |
/**
|
357 |
* Remove all events from mega menu
|
358 |
*/
|
359 |
plugin.unbindAllEvents = function() {
|
360 |
-
$("ul.mega-sub-menu, li.mega-menu-item, a.mega-menu-link", menu).unbind();
|
361 |
};
|
362 |
|
363 |
-
|
364 |
/**
|
365 |
* Bind events to the menu items to allow it to be opened on click, hover or hover intent.
|
366 |
-
* The event will always be "click"
|
367 |
*/
|
368 |
plugin.bindMegaMenuEvents = function() {
|
369 |
-
if (
|
370 |
-
|
371 |
-
|
372 |
-
}
|
373 |
|
374 |
-
|
375 |
-
|
376 |
-
}
|
377 |
}
|
378 |
|
379 |
-
// always bind click events for touch screen devices
|
380 |
-
// click events will be unbound if a hover or hoverIntent event fires
|
381 |
-
bindClickEvents();
|
382 |
};
|
383 |
|
384 |
-
|
385 |
/**
|
386 |
* Monitor the width of the browser so we can tell when the browser has been resized to the point
|
387 |
* where the mobile menu is displayed, and vice versa
|
@@ -401,23 +312,21 @@
|
|
401 |
});
|
402 |
};
|
403 |
|
404 |
-
|
405 |
/**
|
406 |
* Monitor the width of the browser and call functions when menu switches between desktop and mobile view
|
407 |
*/
|
408 |
plugin.checkWidth = function() {
|
409 |
-
if (
|
410 |
$menu.data("view", "mobile");
|
411 |
plugin.switchToMobile();
|
412 |
}
|
413 |
|
414 |
-
if (
|
415 |
$menu.data("view", "desktop");
|
416 |
plugin.switchToDesktop();
|
417 |
}
|
418 |
};
|
419 |
|
420 |
-
|
421 |
/**
|
422 |
* Reverse right aligned menu items so that they appear in the same order on mobile as they do on desktop
|
423 |
*/
|
@@ -425,7 +334,6 @@
|
|
425 |
$menu.append($menu.children("li.mega-item-align-right").get().reverse());
|
426 |
};
|
427 |
|
428 |
-
|
429 |
/**
|
430 |
* Called when the menu view loads in mobile, or switches from desktop to mobile
|
431 |
*/
|
@@ -435,7 +343,6 @@
|
|
435 |
plugin.reverseRightAlignedItems();
|
436 |
};
|
437 |
|
438 |
-
|
439 |
/**
|
440 |
* Called when the menu view switches from mobile to desktop
|
441 |
*/
|
@@ -445,16 +352,12 @@
|
|
445 |
plugin.reverseRightAlignedItems();
|
446 |
};
|
447 |
|
448 |
-
|
449 |
/**
|
450 |
* Initialise the mega menu
|
451 |
*/
|
452 |
plugin.init = function() {
|
453 |
-
|
454 |
$menu.triggerHandler("before_mega_menu_init");
|
455 |
-
|
456 |
plugin.settings = $.extend({}, defaults, options);
|
457 |
-
|
458 |
$menu.removeClass("mega-no-js");
|
459 |
|
460 |
// mobile menu
|
@@ -468,13 +371,10 @@
|
|
468 |
plugin.bindMegaMenuEvents();
|
469 |
plugin.monitorView();
|
470 |
plugin.keyboardNavigation();
|
471 |
-
|
472 |
$menu.triggerHandler("after_mega_menu_init");
|
473 |
-
|
474 |
};
|
475 |
|
476 |
plugin.init();
|
477 |
-
|
478 |
};
|
479 |
|
480 |
$.fn.maxmegamenu = function(options) {
|
@@ -486,9 +386,7 @@
|
|
486 |
});
|
487 |
};
|
488 |
|
489 |
-
|
490 |
$(function() {
|
491 |
$(".mega-menu").maxmegamenu();
|
492 |
});
|
493 |
-
|
494 |
})(jQuery);
|
1 |
/*jslint browser: true, white: true, this: true */
|
2 |
/*global console,jQuery,megamenu,window,navigator*/
|
3 |
|
4 |
+
/*! Max Mega Menu jQuery Plugin */
|
|
|
|
|
5 |
(function($) {
|
|
|
6 |
"use strict";
|
7 |
|
8 |
$.maxmegamenu = function(menu, options) {
|
|
|
9 |
var plugin = this;
|
10 |
var $menu = $(menu);
|
11 |
|
17 |
panel_inner_width: $menu.attr("data-panel-inner-width"),
|
18 |
second_click: $menu.attr("data-second-click"),
|
19 |
vertical_behaviour: $menu.attr("data-vertical-behaviour"),
|
|
|
20 |
document_click: $menu.attr("data-document-click"),
|
21 |
breakpoint: $menu.attr("data-breakpoint")
|
22 |
};
|
23 |
|
24 |
plugin.settings = {};
|
25 |
|
|
|
26 |
/**
|
27 |
* Hides a single panel (sub menu)
|
28 |
*/
|
29 |
plugin.hidePanel = function(anchor, immediate) {
|
30 |
+
if (!immediate && plugin.settings.effect == 'slide' ) {
|
31 |
+
anchor.siblings(".mega-sub-menu").animate({"height":"hide"}, plugin.settings.effect_speed, function() {
|
32 |
+
anchor.siblings(".mega-sub-menu").css("display", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
|
34 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
return;
|
36 |
}
|
37 |
|
38 |
+
if (immediate) {
|
39 |
+
anchor.siblings(".mega-sub-menu").css("display", "none").delay(plugin.settings.effect_speed).queue(function(){
|
40 |
+
$(this).css("display", "").dequeue();
|
41 |
+
});
|
42 |
+
}
|
43 |
|
44 |
+
anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
|
|
|
|
|
45 |
};
|
46 |
|
|
|
47 |
/**
|
48 |
* Hide all open sub menus
|
49 |
*/
|
53 |
});
|
54 |
};
|
55 |
|
|
|
56 |
/**
|
57 |
* For flyout menus: Hide open sub menus at the same level as the sub menu that"s being opened
|
58 |
*/
|
59 |
plugin.hideSiblingPanels = function(anchor, immediate) {
|
60 |
// jQuery 1.7.2 compatibility for themes/plugins that load old versions of jQuery
|
61 |
if ($.fn.addBack !== undefined) {
|
62 |
+
anchor.parent().siblings().find(".mega-toggle-on").addBack().children("a").each(function() { // all open children of open siblings
|
|
|
63 |
plugin.hidePanel($(this), immediate);
|
64 |
});
|
65 |
} else {
|
66 |
+
anchor.parent().siblings().find(".mega-toggle-on").andSelf().children("a").each(function() { // all open children of open siblings
|
|
|
67 |
plugin.hidePanel($(this), immediate);
|
68 |
});
|
69 |
}
|
70 |
};
|
71 |
|
|
|
72 |
/**
|
73 |
* Returns true if the browser width is wider than the Responsive Breakpoint (set in Menu Theme Editor)
|
|
|
74 |
*/
|
75 |
plugin.isDesktopView = function() {
|
76 |
+
return $(window).width() >= plugin.settings.breakpoint;
|
77 |
};
|
78 |
|
|
|
79 |
/**
|
80 |
+
*
|
|
|
81 |
*/
|
82 |
+
plugin.isMobileView = function() {
|
83 |
+
return !plugin.isDesktopView();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
};
|
85 |
|
|
|
86 |
/**
|
87 |
* Display a single panel. Also handles closing of panels that are currently open and need to be closed.
|
88 |
*/
|
89 |
plugin.showPanel = function(anchor) {
|
90 |
+
if (plugin.isMobileView() && anchor.parent().hasClass("mega-hide-sub-menu-on-mobile")) {
|
91 |
return;
|
92 |
}
|
93 |
|
94 |
+
if (plugin.isDesktopView() && ($menu.hasClass("mega-menu-horizontal") || $menu.hasClass("mega-menu-vertical"))) {
|
95 |
+
plugin.hideSiblingPanels(anchor, true);
|
96 |
+
}
|
97 |
+
|
98 |
+
if ((plugin.isMobileView() && $menu.hasClass("mega-keyboard-navigation")) || plugin.settings.vertical_behaviour === "accordion") {
|
99 |
+
plugin.hideSiblingPanels(anchor, false);
|
|
|
|
|
100 |
}
|
101 |
|
102 |
// apply dynamic width and sub menu position
|
133 |
}
|
134 |
|
135 |
// apply jQuery transition (only if the effect is set to "slide", other transitions are CSS based)
|
136 |
+
if ( plugin.settings.effect == "slide" ) {
|
137 |
+
anchor.siblings(".mega-sub-menu").css("display", "none").animate({'height':'show'}, plugin.settings.effect_speed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
anchor.parent().addClass("mega-toggle-on").triggerHandler("open_panel");
|
141 |
};
|
142 |
|
|
|
143 |
/**
|
144 |
* Open sub menus on click
|
145 |
*/
|
146 |
var bindClickEvents = function() {
|
147 |
+
var dragging = false;
|
148 |
+
|
149 |
+
$(document).on({
|
150 |
+
"touchmove": function(e) { dragging = true; },
|
151 |
+
"touchstart": function(e) { dragging = false; }
|
152 |
+
});
|
153 |
+
|
154 |
+
$(document).on("click touchend", function(e) { // hide menu when clicked away from
|
155 |
+
if (!dragging && plugin.settings.document_click === "collapse" && ! $(e.target).closest(".mega-menu li").length ) {
|
156 |
plugin.hideAllPanels();
|
157 |
}
|
158 |
+
dragging = false;
|
159 |
});
|
160 |
|
161 |
var items_with_submenus = $("li.mega-menu-megamenu.mega-menu-item-has-children > a.mega-menu-link, li.mega-menu-flyout.mega-menu-item-has-children > a.mega-menu-link, li.mega-menu-flyout li.mega-menu-item-has-children > a.mega-menu-link", menu);
|
162 |
|
163 |
+
items_with_submenus.on("click.megamenu touchend.megamenu", function(e) {
|
164 |
+
if (dragging) {
|
|
|
165 |
return;
|
166 |
}
|
167 |
+
if (plugin.isMobileView() && $(this).parent().hasClass("mega-hide-sub-menu-on-mobile")) {
|
168 |
+
return; // allow all clicks on parent items when sub menu is hidden on mobile
|
169 |
+
}
|
170 |
|
171 |
// check for second click
|
172 |
if (plugin.settings.second_click === "go" || $(this).parent().hasClass("mega-click-click-go")) {
|
186 |
});
|
187 |
};
|
188 |
|
|
|
189 |
/**
|
190 |
* Open sub menus on hover
|
191 |
*/
|
192 |
var bindHoverEvents = function() {
|
193 |
$("li.mega-menu-item-has-children", menu).not("li.mega-menu-megamenu li.mega-menu-item-has-children", menu).on({
|
194 |
mouseenter: function() {
|
|
|
|
|
|
|
195 |
plugin.unbindClickEvents();
|
196 |
plugin.showPanel($(this).children("a"));
|
197 |
},
|
203 |
});
|
204 |
};
|
205 |
|
|
|
206 |
/**
|
207 |
* Open sub menus on hoverIntent
|
208 |
*/
|
209 |
var bindHoverIntentEvents = function() {
|
210 |
$("li.mega-menu-item-has-children", menu).not("li.mega-menu-megamenu li.mega-menu-item-has-children", menu).hoverIntent({
|
211 |
over: function () {
|
|
|
|
|
|
|
212 |
plugin.unbindClickEvents();
|
213 |
plugin.showPanel($(this).children("a"));
|
214 |
},
|
222 |
});
|
223 |
};
|
224 |
|
|
|
225 |
/**
|
226 |
*
|
227 |
*/
|
228 |
plugin.unbindClickEvents = function() {
|
229 |
+
$("a.mega-menu-link").off("click.megamenu touchend.megamenu");
|
230 |
+
};
|
231 |
|
232 |
/**
|
233 |
* Handle keyboard navigation of the menu. Highlight focused items.
|
257 |
if (keyCode === tab_key) {
|
258 |
$menu.addClass("mega-keyboard-navigation");
|
259 |
|
260 |
+
if ( active_link.parent().hasClass("mega-menu-item-has-children") ) { // menu item with sub menu
|
|
|
261 |
plugin.showPanel(active_link);
|
262 |
+
} else if ( active_link.parent().parent().hasClass("mega-menu") ) { // top level item with no children
|
|
|
263 |
plugin.hideAllPanels();
|
264 |
}
|
265 |
|
270 |
});
|
271 |
};
|
272 |
|
|
|
273 |
/**
|
274 |
* Remove all events from mega menu
|
275 |
*/
|
276 |
plugin.unbindAllEvents = function() {
|
277 |
+
$("ul.mega-sub-menu, li.mega-menu-item, a.mega-menu-link", menu).off().unbind();
|
278 |
};
|
279 |
|
|
|
280 |
/**
|
281 |
* Bind events to the menu items to allow it to be opened on click, hover or hover intent.
|
282 |
+
* The event will always be "click" if the current view is "mobile"
|
283 |
*/
|
284 |
plugin.bindMegaMenuEvents = function() {
|
285 |
+
if (plugin.isDesktopView() && plugin.settings.event === "hover_intent") {
|
286 |
+
bindHoverIntentEvents();
|
287 |
+
}
|
|
|
288 |
|
289 |
+
if (plugin.isDesktopView() && plugin.settings.event === "hover") {
|
290 |
+
bindHoverEvents();
|
|
|
291 |
}
|
292 |
|
293 |
+
bindClickEvents(); // always bind click events for touch screen devices
|
|
|
|
|
294 |
};
|
295 |
|
|
|
296 |
/**
|
297 |
* Monitor the width of the browser so we can tell when the browser has been resized to the point
|
298 |
* where the mobile menu is displayed, and vice versa
|
312 |
});
|
313 |
};
|
314 |
|
|
|
315 |
/**
|
316 |
* Monitor the width of the browser and call functions when menu switches between desktop and mobile view
|
317 |
*/
|
318 |
plugin.checkWidth = function() {
|
319 |
+
if ( plugin.isMobileView() && $menu.data("view") === "desktop" ) {
|
320 |
$menu.data("view", "mobile");
|
321 |
plugin.switchToMobile();
|
322 |
}
|
323 |
|
324 |
+
if ( plugin.isDesktopView() && $menu.data("view") === "mobile" ) {
|
325 |
$menu.data("view", "desktop");
|
326 |
plugin.switchToDesktop();
|
327 |
}
|
328 |
};
|
329 |
|
|
|
330 |
/**
|
331 |
* Reverse right aligned menu items so that they appear in the same order on mobile as they do on desktop
|
332 |
*/
|
334 |
$menu.append($menu.children("li.mega-item-align-right").get().reverse());
|
335 |
};
|
336 |
|
|
|
337 |
/**
|
338 |
* Called when the menu view loads in mobile, or switches from desktop to mobile
|
339 |
*/
|
343 |
plugin.reverseRightAlignedItems();
|
344 |
};
|
345 |
|
|
|
346 |
/**
|
347 |
* Called when the menu view switches from mobile to desktop
|
348 |
*/
|
352 |
plugin.reverseRightAlignedItems();
|
353 |
};
|
354 |
|
|
|
355 |
/**
|
356 |
* Initialise the mega menu
|
357 |
*/
|
358 |
plugin.init = function() {
|
|
|
359 |
$menu.triggerHandler("before_mega_menu_init");
|
|
|
360 |
plugin.settings = $.extend({}, defaults, options);
|
|
|
361 |
$menu.removeClass("mega-no-js");
|
362 |
|
363 |
// mobile menu
|
371 |
plugin.bindMegaMenuEvents();
|
372 |
plugin.monitorView();
|
373 |
plugin.keyboardNavigation();
|
|
|
374 |
$menu.triggerHandler("after_mega_menu_init");
|
|
|
375 |
};
|
376 |
|
377 |
plugin.init();
|
|
|
378 |
};
|
379 |
|
380 |
$.fn.maxmegamenu = function(options) {
|
386 |
});
|
387 |
};
|
388 |
|
|
|
389 |
$(function() {
|
390 |
$(".mega-menu").maxmegamenu();
|
391 |
});
|
|
|
392 |
})(jQuery);
|
megamenu.php
CHANGED
@@ -4,11 +4,11 @@
|
|
4 |
* Plugin Name: Max Mega Menu
|
5 |
* Plugin URI: https://www.maxmegamenu.com
|
6 |
* Description: Easy to use drag & drop WordPress Mega Menu plugin. Create Mega Menus using Widgets. Responsive, retina & touch ready.
|
7 |
-
* Version: 2.
|
8 |
* Author: Tom Hemsley
|
9 |
* Author URI: https://www.maxmegamenu.com
|
10 |
* License: GPL-2.0+
|
11 |
-
* Copyright:
|
12 |
*/
|
13 |
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -26,13 +26,13 @@ final class Mega_Menu {
|
|
26 |
/**
|
27 |
* @var string
|
28 |
*/
|
29 |
-
public $version = '2.
|
30 |
|
31 |
|
32 |
/**
|
33 |
* @var string
|
34 |
*/
|
35 |
-
public $scss_last_updated = '2.
|
36 |
|
37 |
|
38 |
/**
|
@@ -67,6 +67,7 @@ final class Mega_Menu {
|
|
67 |
add_filter( 'megamenu_nav_menu_objects_before', array( $this, 'setup_menu_items' ), 5, 2 );
|
68 |
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'reorder_menu_items_within_megamenus' ), 6, 2 );
|
69 |
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'apply_classes_to_menu_items' ), 7, 2 );
|
|
|
70 |
add_filter( 'body_class', array($this, 'add_megamenu_body_classes'), 10, 1);
|
71 |
|
72 |
add_filter( 'megamenu_nav_menu_css_class', array( $this, 'prefix_menu_classes' ) );
|
@@ -100,7 +101,7 @@ final class Mega_Menu {
|
|
100 |
/**
|
101 |
* Add a body class for each active mega menu location.
|
102 |
*
|
103 |
-
* @since 2.
|
104 |
* @param array $classes
|
105 |
* @return array
|
106 |
*/
|
@@ -616,6 +617,34 @@ final class Mega_Menu {
|
|
616 |
}
|
617 |
|
618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
/**
|
620 |
* Apply column and clear classes to menu items (inc. widgets)
|
621 |
*
|
@@ -711,8 +740,22 @@ final class Mega_Menu {
|
|
711 |
*/
|
712 |
public function modify_nav_menu_args( $args ) {
|
713 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
714 |
$settings = get_option( 'megamenu_settings' );
|
715 |
$current_theme_location = $args['theme_location'];
|
|
|
|
|
|
|
|
|
|
|
716 |
|
717 |
$locations = get_nav_menu_locations();
|
718 |
|
4 |
* Plugin Name: Max Mega Menu
|
5 |
* Plugin URI: https://www.maxmegamenu.com
|
6 |
* Description: Easy to use drag & drop WordPress Mega Menu plugin. Create Mega Menus using Widgets. Responsive, retina & touch ready.
|
7 |
+
* Version: 2.3
|
8 |
* Author: Tom Hemsley
|
9 |
* Author URI: https://www.maxmegamenu.com
|
10 |
* License: GPL-2.0+
|
11 |
+
* Copyright: 2016 Tom Hemsley (https://www.maxmegamenu.com)
|
12 |
*/
|
13 |
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
26 |
/**
|
27 |
* @var string
|
28 |
*/
|
29 |
+
public $version = '2.3';
|
30 |
|
31 |
|
32 |
/**
|
33 |
* @var string
|
34 |
*/
|
35 |
+
public $scss_last_updated = '2.3';
|
36 |
|
37 |
|
38 |
/**
|
67 |
add_filter( 'megamenu_nav_menu_objects_before', array( $this, 'setup_menu_items' ), 5, 2 );
|
68 |
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'reorder_menu_items_within_megamenus' ), 6, 2 );
|
69 |
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'apply_classes_to_menu_items' ), 7, 2 );
|
70 |
+
add_filter( 'megamenu_nav_menu_objects_after', array( $this, 'set_descriptions_if_enabled' ), 8, 2 );
|
71 |
add_filter( 'body_class', array($this, 'add_megamenu_body_classes'), 10, 1);
|
72 |
|
73 |
add_filter( 'megamenu_nav_menu_css_class', array( $this, 'prefix_menu_classes' ) );
|
101 |
/**
|
102 |
* Add a body class for each active mega menu location.
|
103 |
*
|
104 |
+
* @since 2.3
|
105 |
* @param array $classes
|
106 |
* @return array
|
107 |
*/
|
617 |
}
|
618 |
|
619 |
|
620 |
+
|
621 |
+
/**
|
622 |
+
* If descriptions are enabled, create a new 'mega_description' property.
|
623 |
+
* This is for backwards compatibility for users who have used filters
|
624 |
+
* to display descriptions
|
625 |
+
*
|
626 |
+
* @since 2.3
|
627 |
+
* @param array $items
|
628 |
+
* @param array $args
|
629 |
+
* @return array
|
630 |
+
*/
|
631 |
+
public function set_descriptions_if_enabled( $items, $args ) {
|
632 |
+
|
633 |
+
$settings = get_option( 'megamenu_settings' );
|
634 |
+
|
635 |
+
$descriptions = isset( $settings['descriptions'] ) ? $settings['descriptions'] : 'disabled';
|
636 |
+
|
637 |
+
if ($descriptions == 'enabled') {
|
638 |
+
foreach ( $items as $item ) {
|
639 |
+
if ( property_exists( $item, 'description' ) && strlen( $item->description ) ) {
|
640 |
+
$item->mega_description = $item->description;
|
641 |
+
}
|
642 |
+
}
|
643 |
+
}
|
644 |
+
|
645 |
+
return $items;
|
646 |
+
}
|
647 |
+
|
648 |
/**
|
649 |
* Apply column and clear classes to menu items (inc. widgets)
|
650 |
*
|
740 |
*/
|
741 |
public function modify_nav_menu_args( $args ) {
|
742 |
|
743 |
+
if ( ! isset( $args['theme_location'] ) ) {
|
744 |
+
return $args;
|
745 |
+
}
|
746 |
+
|
747 |
+
// internal filter
|
748 |
+
do_action('megamenu_instance_counter_' . $args['theme_location']);
|
749 |
+
|
750 |
+
$num_times_called = did_action('megamenu_instance_counter_' . $args['theme_location']);
|
751 |
+
|
752 |
$settings = get_option( 'megamenu_settings' );
|
753 |
$current_theme_location = $args['theme_location'];
|
754 |
+
$active_instance = isset( $settings['instances'][$current_theme_location] ) ? $settings['instances'][$current_theme_location] : 0;
|
755 |
+
|
756 |
+
if ( $active_instance != 0 && $active_instance != $num_times_called ) {
|
757 |
+
return $args;
|
758 |
+
}
|
759 |
|
760 |
$locations = get_nav_menu_locations();
|
761 |
|
readme.txt
CHANGED
@@ -2,16 +2,16 @@
|
|
2 |
Contributors: megamenu
|
3 |
Tags: menu, megamenu, mega menu, navigation, widget, dropdown menu, drag and drop, mobile, responsive, retina, theme editor, widget, shortcode, sidebar, icons, dashicons
|
4 |
Requires at least: 3.8
|
5 |
-
Tested up to: 4.
|
6 |
Stable tag: 2.2.3.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
-
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
|
15 |
|
16 |
https://www.youtube.com/watch?v=44dJwP1AXT8
|
17 |
|
@@ -19,21 +19,29 @@ Documentation & Demo: https://www.maxmegamenu.com
|
|
19 |
|
20 |
###Features:
|
21 |
|
22 |
-
*
|
|
|
|
|
23 |
* Display WordPress Widgets in your menu
|
24 |
-
*
|
25 |
-
* Supports Flyout (traditional) or Mega Menu sub
|
26 |
-
* Hover Intent or
|
27 |
-
* Fade or Slide transitions
|
28 |
* Add icons to menu items
|
29 |
-
*
|
30 |
* Align menu items to the left or right of the menu bar
|
31 |
* Align sub menus to left or right of parent menu item
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
33 |
* Responsive, Touch & Retina Ready
|
34 |
-
*
|
|
|
35 |
* Clean code with a low memory footprint
|
36 |
-
*
|
37 |
* In depth documentation
|
38 |
* Basic Support
|
39 |
|
@@ -71,9 +79,7 @@ Getting started:
|
|
71 |
|
72 |
https://www.maxmegamenu.com/documentation/installation/
|
73 |
|
74 |
-
Not working with your theme?
|
75 |
-
Mobile menu not working?
|
76 |
-
Multiple mobile menu toggle icons?
|
77 |
|
78 |
https://www.maxmegamenu.com/documentation/removing-residual-styling/
|
79 |
|
@@ -97,24 +103,25 @@ See https://www.maxmegamenu.com for more screenshots
|
|
97 |
|
98 |
== Changelog ==
|
99 |
|
100 |
-
= 2.
|
101 |
|
102 |
-
* New Feature:
|
103 |
-
* New Feature:
|
104 |
-
*
|
105 |
-
|
106 |
-
|
107 |
* Fix: Mobile menu now always switches to click, even on desktops
|
108 |
* Fix: Responsive Breakpoint validation
|
109 |
-
* Fix:
|
110 |
* Fix: Remove margin from right aligned menu items on mobile
|
111 |
* Fix: Apply hover styling to current-page-ancestor
|
112 |
* Fix: Fix WPML cache clearing when CSS Output is set to Output in head
|
113 |
* Fix: Allow single quotes in theme editor custom CSS
|
114 |
* Fix: Allow single quotes in Menu Toggle toggle block text
|
115 |
* Fix: Improve theme editor settings validation
|
116 |
-
* Change: Remove permanent 'Go Pro' nag from Plugins page.
|
117 |
-
* Change: Add mega-menu-location body class when MMM is enabled for a location to pave the way for automatic theme integration
|
|
|
118 |
|
119 |
= 2.2.3.1 [23/08/2016] =
|
120 |
|
2 |
Contributors: megamenu
|
3 |
Tags: menu, megamenu, mega menu, navigation, widget, dropdown menu, drag and drop, mobile, responsive, retina, theme editor, widget, shortcode, sidebar, icons, dashicons
|
4 |
Requires at least: 3.8
|
5 |
+
Tested up to: 4.7
|
6 |
Stable tag: 2.2.3.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
+
An easy to use mega menu plugin. Written the WordPress way.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
Max Mega Menu will automatically convert your existing menu or menus into a mega menu. You can then add any WordPress widget to your menu, restyle your menu using the theme editor and change the menu behaviour using the built in settings. Max Mega Menu is a complete menu management plugin, perfect for taking control of your existing menu and turning it into a user-friendly, accessible and touch ready menu with just a few clicks.
|
15 |
|
16 |
https://www.youtube.com/watch?v=44dJwP1AXT8
|
17 |
|
19 |
|
20 |
###Features:
|
21 |
|
22 |
+
* Builds upon the standard WordPress menus system
|
23 |
+
* Supports multiple menu locations each with their own configuration
|
24 |
+
* Drag and Drop Mega Menu builder
|
25 |
* Display WordPress Widgets in your menu
|
26 |
+
* Customise the styling of your menus using a built in theme editor
|
27 |
+
* Supports Flyout (traditional) or Mega Menu sub menu styles
|
28 |
+
* Hover, Hover Intent or Click event to open sub menus
|
29 |
+
* Fade, Fade Up, Slide Up or Slide sub menu transitions
|
30 |
* Add icons to menu items
|
31 |
+
* Menu item options including Hide Text, Disable Link, Hide on Mobile etc
|
32 |
* Align menu items to the left or right of the menu bar
|
33 |
* Align sub menus to left or right of parent menu item
|
34 |
+
|
35 |
+
Max Mega Menu is developed with a focus on code quality, performance and usability.
|
36 |
+
|
37 |
+
* The only mega menu plugin with zero "!important", block or inline CSS styles
|
38 |
+
* Menus are styled using a single, static CSS file
|
39 |
+
* Less than 2kb JavaScript (when gzipped)
|
40 |
* Responsive, Touch & Retina Ready
|
41 |
+
* Built with accessibity in mind - keyboard navigation supported
|
42 |
+
* Extensively tested in all modern desktop and mobile browsers
|
43 |
* Clean code with a low memory footprint
|
44 |
+
* Filters and actions where you need them
|
45 |
* In depth documentation
|
46 |
* Basic Support
|
47 |
|
79 |
|
80 |
https://www.maxmegamenu.com/documentation/installation/
|
81 |
|
82 |
+
Not working with your theme? Mobile menu not working? Multiple mobile menu toggle icons?
|
|
|
|
|
83 |
|
84 |
https://www.maxmegamenu.com/documentation/removing-residual-styling/
|
85 |
|
103 |
|
104 |
== Changelog ==
|
105 |
|
106 |
+
= 2.3 =
|
107 |
|
108 |
+
* New Feature: "Hover" event added (options are now Hover Intent, Hover or Click)
|
109 |
+
* New Feature: Menu Item Description support added
|
110 |
+
* New Feature: Add "Active Menu Instance" setting to allow mega menu to only be applied to an individual instance of a wp_nav_menu call (rather than all of them)
|
111 |
+
* Fix: Hover not working on some devices with touch screens. This has been tested for Hover, Hover Intent and Click on:
|
112 |
+
Mac FireFox/Safari/Chrome, Windows Edge/IE9/IE10/IE11/FireFox/Chrome, iPhone, iPad Chrome/Safari, Andoid Default/Chrome. If you have problems with touch or hover, please post in the support forums detailing exactly which Operating System, Browser and Event you are using so that I can reproduce the issue here.
|
113 |
* Fix: Mobile menu now always switches to click, even on desktops
|
114 |
* Fix: Responsive Breakpoint validation
|
115 |
+
* Fix: Swiping background on touch devices hides sub menus
|
116 |
* Fix: Remove margin from right aligned menu items on mobile
|
117 |
* Fix: Apply hover styling to current-page-ancestor
|
118 |
* Fix: Fix WPML cache clearing when CSS Output is set to Output in head
|
119 |
* Fix: Allow single quotes in theme editor custom CSS
|
120 |
* Fix: Allow single quotes in Menu Toggle toggle block text
|
121 |
* Fix: Improve theme editor settings validation
|
122 |
+
* Change: Remove permanent 'Go Pro' nag from Plugins page.
|
123 |
+
* Change: Add "mega-menu-location" body class when MMM is enabled for a location to pave the way for automatic theme integration
|
124 |
+
* Improvement: Add ".mega-multi-line" CSS to aid display of menu items with br tags in title
|
125 |
|
126 |
= 2.2.3.1 [23/08/2016] =
|
127 |
|