All Projects → studiopress → responsive-menus

studiopress / responsive-menus

Licence: other
Genesis Responsive Menus

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to responsive-menus

React Menu
React component for building accessible menu, dropdown, submenu, context menu and more.
Stars: ✭ 237 (+811.54%)
Mutual labels:  menu
UIMenuScroll
The horizontal swiping navigation like on Facebook Messenger.
Stars: ✭ 18 (-30.77%)
Mutual labels:  menu
impromptu.nvim
Create prompts fast and easy
Stars: ✭ 39 (+50%)
Mutual labels:  menu
Dropdownmenukit
UIKit drop down menu, simple yet flexible and written in Swift
Stars: ✭ 246 (+846.15%)
Mutual labels:  menu
Teaset
A UI library for react native, provides 20+ pure JS(ES6) components, focusing on content display and action control.
Stars: ✭ 2,845 (+10842.31%)
Mutual labels:  menu
oc-menumanager-plugin
A Menu Management Plugin for October CMS
Stars: ✭ 29 (+11.54%)
Mutual labels:  menu
Spotmenu
Stars: ✭ 2,668 (+10161.54%)
Mutual labels:  menu
ember-right-click-menu
An easy and flexible addon to add context menus anywhere in your application
Stars: ✭ 14 (-46.15%)
Mutual labels:  menu
Easydropdown
💧 Fantastic dropdown in Swift
Stars: ✭ 254 (+876.92%)
Mutual labels:  menu
ConsoleMenu
A simple, highly customizable, DOS-like console menu
Stars: ✭ 27 (+3.85%)
Mutual labels:  menu
Kyarctab
Arcuated tab view controller with toggleing animation, 2 ~ 4 tabs are enabled. What's more, you can swipe left or right to toggle the views.
Stars: ✭ 246 (+846.15%)
Mutual labels:  menu
Side Menu.ios
Animated side menu with customizable UI
Stars: ✭ 2,702 (+10292.31%)
Mutual labels:  menu
xdg-xmenu
Generate menu for xmenu
Stars: ✭ 31 (+19.23%)
Mutual labels:  menu
Pygame Menu
Menu for pygame. Simple, lightweight and easy to use
Stars: ✭ 244 (+838.46%)
Mutual labels:  menu
restaurant-bot
This is an Android application that can be used for providing a digital menu for a restaurant.
Stars: ✭ 42 (+61.54%)
Mutual labels:  menu
React Native Dropdown Picker
A single / multiple, categorizable & searchable item picker (dropdown) component for react native which supports both Android & iOS.
Stars: ✭ 230 (+784.62%)
Mutual labels:  menu
curved-menu
VanillaJS fully configurable curved menu (circular navigation)
Stars: ✭ 30 (+15.38%)
Mutual labels:  menu
SwipeToActionLayout
Layout, which provides swipe to reveal behaviour 🎭
Stars: ✭ 85 (+226.92%)
Mutual labels:  menu
SliderMenu
A simple Menu inspired by SWRevealView Controller and Google Material Menu
Stars: ✭ 35 (+34.62%)
Mutual labels:  menu
JonContextMenu
A beautiful and minimalist arc menu like the Pinterest one, written in Swift
Stars: ✭ 60 (+130.77%)
Mutual labels:  menu

ResponsiveMenus.js

This script adds accessibility-compatible responsive menus to Genesis Framework child themes. It is intended as a drop-in plugin that accepts a localized object of settings for the script to use.

Settings

Settings can be added by localizing an array of appropriate values to the repsonsive-menus.js script (or responsive-menus.min.js if you are serving production).

function prefix_responsive_menu_settings() {

	$settings = array(
		'mainMenu'         => __( 'Menu', 'magazine' ),
		'menuIconClass'    => 'dashicons-before dashicons-menu',
		'subMenu'          => __( 'Menu', 'magazine' ),
		'subMenuIconClass' => 'dashicons-before dashicons-arrow-down-alt2',
		'menuClasses'      => array(
			'combine' => array(
				'.nav-primary',
				'.nav-header',
				'.nav-secondary',
			),
			'others'  => array(
				'.nav-footer',
				'.nav-sidebar',
			),
		),
	);

	return $settings;

}

Next, localize your settings to the responsive menus script (this way for readability):

wp_localize_script(
	'responsive-menu-handle',
	'genesis_responsive_menu',
	prefix_responsive_menu_settings()
);

Options

mainMenu

Required. Accepts a string of text to use for the Main Menu toggle button. Pass an empty string for no text.

menuIconClass

Accepts a string of classes. These will be passed to an empty <span> tag within the Main Menu toggle button. To bypass an icon being added, pass an empty string to the value.

Removing defaults to the dashicons menu icon.

subMenu

Required. Accepts a string of text to use for the Sub Menu toggle button (wrapped in <span class="screen-reader-text"></span>). Pass an empty string for no text (not recommended).

subMenuIconClass

Required. Accepts a string of classes. These will be passed to an empty <span> tag within the Sub Menu toggle button to be used for dropdowns.

menuClasses

Required. Accepts two separate arrays for menus to combine and menus to handle as their own.

combine

Accepts an array of menu class names to target. Menus are treated by order of appearance, so the first value in the array will get the Main Menu toggle button, while the rest will be appended (or combined) to that first menu. If the first menu is not on the page, the next menu in the array will be given priority as the first, and so on.

If there is only one menu showing on the page that's within the combine array, this menu will be shifted to the others array and combining will be skipped to save resources.

others

Accepts an array of menu class names to target. Each menu will recieve it's own Main Menu toggle and act separately from all others on the page.

Required CSS

The script relies on media query CSS declarations in order to trigger it's functionality. The following CSS is required in your Genesis child theme in order for the script to work properly:

Inactive Styles

Use the following styles for when you don't want the script to activate:

/* Accessible Menu
--------------------------------------------- */

.menu .menu-item:focus {
	position: static;
}

.menu .menu-item > a:focus + ul.sub-menu,
.menu .menu-item.sfHover > ul.sub-menu {
	left: auto;
	opacity: 1;
}

.menu-toggle,
.sub-menu-toggle {
	display: none;
	visibility: hidden;
}

Active Styles

Use the following styles as a starting point for when you want the menu to work. Usually nested in a media query defining the trigger point (added for reference):

@media only screen ( max-width: 800px ) {
	.genesis-responsive-menu .wrap {
		padding: 0;
	}

	.genesis-responsive-menu {
		display: none;
		position: relative;
	}

	.genesis-skip-link .skip-link-hidden {
		display: none;
		visibility: hidden;
	}

	.menu-toggle,
	.sub-menu-toggle {
		border-width: 0;
		background-color: #fff;
		color: #333;
		display: block;
		margin: 0 auto;
		overflow: hidden;
		text-align: center;
		visibility: visible;
	}

	.menu-toggle:focus,
	.menu-toggle:hover,
	.sub-menu-toggle:focus,
	.sub-menu-toggle:hover {
		background: transparent;
		color: #c3251d;
		border-width: 0;
	}

	.menu-toggle {
		line-height: 20px;
		position: relative;
		z-index: 1000;
		width: 100%;
	}

	.menu-toggle::before {
		font-size: 1.5em;
		margin-right: 10px;
		text-rendering: auto;
		vertical-align: middle;
	}

	.sub-menu-toggle {
		float: right;
		padding: 10px;
		position: absolute;
		right: 0;
		top: 0;
		z-index: 100;
	}

	.sub-menu-toggle::before {
		display: inline-block;
		text-rendering: auto;
		-webkit-transform: rotate( 0 );
		-ms-transform:     rotate( 0 );
		transform:         rotate( 0 );
		-webkit-transition: transform .25s ease-in-out;
		-ms-transition:     transform .25s ease-in-out;
		transition:         transform .25s ease-in-out;
	}

	.sub-menu-toggle.activated::before {
		-webkit-transform: rotate( 180deg );
		-ms-transform:     rotate( 180deg );
		transform:         rotate( 180deg );
	}

	.genesis-responsive-menu .genesis-nav-menu .menu-item {
		display: block;
		float: none;
		position: relative;
		text-align: left;
	}

	.genesis-responsive-menu .genesis-nav-menu .menu-item:focus,
	.genesis-responsive-menu .genesis-nav-menu .menu-item:hover {
		position: relative;
	}

	.genesis-responsive-menu .genesis-nav-menu a:focus,
	.genesis-responsive-menu .genesis-nav-menu a:hover {
		color: #c3251d;
	}

	.genesis-responsive-menu .genesis-nav-menu .menu-item a {
		border: none;
		margin-bottom: 1px;
		padding: 15px 20px;		
		width: 100%;
	}

	.genesis-responsive-menu .genesis-nav-menu .sub-menu {
		border: none;
	}

	.genesis-responsive-menu .genesis-nav-menu .menu-item > a:focus ul.sub-menu,
	.genesis-responsive-menu .genesis-nav-menu .menu-item > a:focus ul.sub-menu .sub-menu {
		left: 0;
		margin-left: 0;
	}

	.genesis-responsive-menu .genesis-nav-menu > .menu-item-has-children > a::after {
		content: none;
	}

	.genesis-responsive-menu .genesis-nav-menu .sub-menu {
		clear: both;
		display: none;
		margin: 0;
		opacity: 1;
		padding-left: 15px;
		position: static;
		width: 100%;
	}

	.genesis-responsive-menu .genesis-nav-menu .sub-menu .sub-menu {
		margin: 0;
	}
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].