Панель Управления


Видеокурс: "Javascript+jQuery для начинающих в видеоформате" Проверка времени и определение часового пояса рабочей станции. RU-CENTER. Центр регистрации доменов зоны .RU Сейчас выгодная возможность зарегистрировать домен .РФ в RU-CENTER Информационная безопасность Система интернет-расчетов RUpay Графический редактор ГИМП (GIMP) Зинаида Лукьянова. Видеокурс Фотошоп с нуля. Евгений Попов. Видеокурс HTML + PHP + MySQL. Весь Софт Софтодром "Электрошоп". Поиск электронных товаров. Джава. Ява. Java. Дмитрий Котеров, Алексей Костарев. PHP-5. Наиболее полное руководство. 2-е издание.



Элемент Меню (Menu) плагина UI библиотеки jQuery.
Плагин UI версии 1.9.2 библиотеки jQuery версии 1.8.3 Сделано в kocby.ru Элемент Меню (Menu) плагина UI библиотеки jQuery. Меню может быть создано из любого валидного маркируемого списка до тех пор, пока элементы имеют строгое отношение родитель/ребенок и каждый пункт имеет якорь. Наиболее типичный используемый элемент есть список без порядковых номеров.
© Перепечатка разрешается с установкой ссылки на ресурс http://kocby.ru
Menu :: Меню
Описание: Меню с поддержкой разных тем и с навигацией при помощи мыши и клавиатуры.
Description: Themeable menu with mouse and keyboard interactions for navigation.

Пример странички Меню Дефолтное (по умолчанию, Default functionality):
можно посмотреть здесь.

Пример странички Меню, Иконки (Icons):
можно посмотреть здесь.




Теория

Тесты по теории можно посмотреть здесь.




Options (Опции)



disabled
Type: Boolean
Default: false

Disables the menu if set to true.

Выключает Меню, если опция установлена на значение true (истина).

Code examples: (Примеры кода: )
Initialize the menu with the disabled option specified:
Инициализация Меню с определенной опцией disabled:

$( ".selector" ).menu({ disabled: true });


Get or set the disabled option, after initialization:
Можно получить или установить опцию disabled после инициализации:

// getter
var disabled = $( ".selector" ).menu( "option", "disabled" );
 
// setter
$( ".selector" ).menu( "option", "disabled", true );



icons
Type: Object
Default: { submenu: "ui-icon-carat-1-e" }

Icons to use for submenus, matching an icon defined by the jQuery UI CSS Framework.

Иконки для использования в подменю, соответствует определяем иконок в фреймворке jQuery UI CSS.

• submenu (string, default: "ui-icon-carat-1-e")

Code examples: (Примеры кода: )
Initialize the menu with the icons option specified:
Инициализация Меню с определенной опцией icons:

$( ".selector" ).menu({ icons: { submenu: "ui-icon-circle-triangle-e" } });


Get or set the icons option, after initialization:
Можно получить или установить опцию icons после инициализации:

// getter
var icons = $( ".selector" ).menu( "option", "icons" );
 
// setter
$( ".selector" ).menu( "option", "icons", { submenu: "ui-icon-circle-triangle-e" } );



menus
Type: String
Default: "ul"

Selector for the elements that serve as the menu container, including sub-menus.

Селектор для элементов, которые служат, как контейнеры меню, включая под-меню.

Code examples: (Примеры кода: )
Initialize the menu with the menus option specified:
Инициализация Меню с определенной опцией menus:

$( ".selector" ).menu({ menus: "div" });


Get or set the menus option, after initialization:
Можно получить или установить опцию menus после инициализации:

// getter
var menus = $( ".selector" ).menu( "option", "menus" );
 
// setter
$( ".selector" ).menu( "option", "menus", "div" );



position
Type: Object
Default: { my: "left top", at: "right top" }

Identifies the position of submenus in relation to the associated parent menu item. The of option defaults to the parent menu item, but you can specify another element to position against. You can refer to the jQuery UI Position utility for more details about the various options.

Определяет позицию под-меню относительно связанного родительского пункта меню. Опция of (относительно чего) по умолчанию соответствует родительскому пункту меню, но вы можете определить другой элемент для позиционирования. Мы можете обратиться к утилите jQuery UI Position за деталями о разных возможных опциях.

Code examples: (Примеры кода: )
Initialize the menu with the position option specified:
Инициализация Меню с определенной опцией position:

$( ".selector" ).menu({ position: { my: "left top", at: "right-5 top+5" } });


Get or set the position option, after initialization:
Можно получить или установить опцию position после инициализации:

// getter
var position = $( ".selector" ).menu( "option", "position" );
 
// setter
$( ".selector" ).menu( "option", "position", { my: "left top", at: "right-5 top+5" } );



role
Type: String
Default: "menu"

Customize the ARIA roles used for the menu and menu items. The default uses "menuitem" for items. Setting the role option to "listbox" will use "option" for items. If set to null, no roles will be set, which is useful if the menu is being controlled by another element that is maintaining focus.

Можно адаптировать роли ARIA, которые используются для меню и пунктов меню. По умолчанию для пунктов меню используется "menuitem" ("пункт меню"). Установка опции role (роль) на значение "listbox" ("ЛистБокс") приведет к использованию значения "option" ("опция") для пунктов меню. Если установлена на значение null (ничего), никакие роли не будут установлены, что полезно, если меню управляется другим элементом делает фокусирование.

Code examples: (Примеры кода: )
Initialize the menu with the role option specified:
Инициализация Меню с определенной опцией role:

$( ".selector" ).menu({ role: null });


Get or set the role option, after initialization:
Можно получить или установить опцию role после инициализации:

// getter
var role = $( ".selector" ).menu( "option", "role" );
 
// setter
$( ".selector" ).menu( "option", "role", null );






Methods (Методы)



blur( [event ] )
Removes focus from a menu, resets any active element styles and triggers the menu's blur event.
Удаляет фокус из меню, сбрасывает все стили и тригеры активного элемента.
• event
Type: Event
What triggered the menu to blur.
Что заставляет меню терять фокус.

Code examples: (Примеры кода: )
Invoke the blur method:
Запуск метода blur (потеря фокуса):
$( ".selector" ).menu( "blur" );



collapse( [event ] )
Closes the currently active sub-menu.
Закрывает текущее активное под-меню.
• event
Type: Event
What triggered the menu to collapse.
Какое событие заставляет меню закрываться.

Code examples: (Примеры кода: )
Invoke the collapse method:
Запуск метода collapse (закрытие меню):
$( ".selector" ).menu( "collapse" );



collapseAll( [event ] [, all ] )
Closes all open sub-menus.
Закрывает все открытые под-меню.
• event
Type: Event
What triggered the menu to collapse.
Какое событие заставляет меню закрываться.
• all
Type: Boolean
Indicates whether all sub-menus should be closed or only sub-menus below and including the menu that is or contains the target of the triggering event.
Показывает, все ли под-меню должны закрываться или только под-меню ниже, включая меню, которое является или содержит цель трегируемого события.


Code examples: (Примеры кода: )
Invoke the collapseAll method:
Запуск метода collapseAll (закрытие всех меню):
$( ".selector" ).menu( "collapseAll", null, true );



destroy()
Removes the menu functionality completely. This will return the element back to its pre-init state.
• This method does not accept any arguments.

Полностью удаляет функциональность Меню. Возвращает элемент обратно в состояние до инициализации.
• Этот метод не принимает никаких аргументов.

Code examples: (Примеры кода: )
Invoke the destroy method:
Запуск метода destroy:
$( ".selector" ).menu( "destroy" );



disable()
Disables the menu.
• This method does not accept any arguments.

Выключает меню.
• Этот метод не принимает никаких аргументов.

Code examples: (Примеры кода: )
Invoke the disable method:
Запуск метода disable:
$( ".selector" ).menu( "disable" );



enable()
Enables the menu.
• This method does not accept any arguments.

Включает меню.
• Этот метод не принимает никаких аргументов.

Code examples: (Примеры кода: )
Invoke the enable method:
Запуск метода enable:
$( ".selector" ).menu( "enable" );



expand( [event ] )
Opens the sub-menu below the currently active item, if one exists.

Открывает под-меню ниже текущего активного пункта, если существует.

• event
Type: Event
What triggered the menu to expand.
Какое событие заставляет меню открываться.


Code examples: (Примеры кода: )
Invoke the expand method:
Запуск метода expand:
$( ".selector" ).menu( "expand" );



focus( [event ], item )
Activates a particular menu item, begins opening any sub-menu if present and triggers the menu's focus event.

Активирует конкретный пункт меню, начинает открывать любое по-меню, если существует и триггирует событие меню focus.

• event
Type: Event
What triggered the menu item to gain focus.
Какое событие заставляет пункт меню получить фокус.
• item
Type: jQuery
The menu item to focus/activate.
Пункт Меню для фокуса/активации.

Code examples: (Примеры кода: )
Invoke the focus method:
Запуск метода focus:
$( ".selector" ).menu( "focus", null, menu.find( ".ui-menu-item:last" ) );



isFirstItem()
Returns a boolean value stating whether or not the currently active item is the first item in the menu.
• This method does not accept any arguments.

Возвращает булевское значение, которое показывает является ли текущий активный пункт первым пунктом в меню.
• Этот метод не принимает никаких аргументов.

Code examples: (Примеры кода: )
Invoke the isFirstItem method:
Запуск метода isFirstItem:
var firstItem = $( ".selector" ).menu( "isFirstItem" );



isLastItem()
Returns a boolean value stating whether or not the currently active item is the last item in the menu.
• This method does not accept any arguments.

Возвращает булевское значение, которое показывает является ли текущий активный пункт последним пунктом в меню.
• Этот метод не принимает никаких аргументов.

Code examples: (Примеры кода: )
Invoke the isLastItem method:
Запуск метода isLastItem:
var lastItem = $( ".selector" ).menu( "isLastItem" );



next( [event ] )
Moves active state to next menu item.

Перемещает активный статус к следующему пункту меню.

• event
Type: Event
What triggered the focus to move.
Какое событие заставляет фокус перемещаться.


Code examples: (Примеры кода: )
Invoke the next method:
Запуск метода next:
$( ".selector" ).menu( "next" );



nextPage( [event ] )
Moves active state to first menu item below the bottom of a scrollable menu or the last item if not scrollable.

Перемещает активный статус к первому пункту меню ниже низа скроллируемого меню или к последнему пункту нескроллируемого.

• event
Type: Event
What triggered the focus to move.
Какое событие заставляет фокус перемещаться.


Code examples: (Примеры кода: )
Invoke the nextPage method:
Запуск метода nextPage:
$( ".selector" ).menu( "nextPage" );



option( optionName )
Returns: Object
Gets the value currently associated with the specified optionName.
Получает значение, связанное с определенным optionName (имя опции).
• optionName
Type: String
The name of the option to get.
Имя опции, для которой получаем значение.

Code examples: (Примеры кода: )
Invoke the method:
Запуск метода:
var isDisabled = $( ".selector" ).menu( "option", "disabled" );



option()
Returns: PlainObject
Gets an object containing key/value pairs representing the current menu options hash.
• This method does not accept any arguments.

Получает объект, содержащий пары key/value (ключ/значение), представляющий текущее состояние набора значений Меню.
• Этот метод не принимает никаких аргументов.

Code examples: (Примеры кода: )
Invoke the method:
Запуск метода:
var options = $( ".selector" ).menu( "option" );



option( optionName, value )
Sets the value of the menu option associated with the specified optionName.
Устанавливает значение опции Меню, связанное с определенным optionName (именем опции).

• optionName
Type: String
The name of the option to set.
Имя опции для установки.

• value
Type: Object
A value to set for the option.
Значение, которое устанавливается для опции.

Code examples: (Примеры кода: )
Invoke the method:
Запуск метода:
$( ".selector" ).menu( "option", "disabled", true );



option( options )
Sets one or more options for the menu.

Устанавливает одну или более опций для Меню.

• options
Type: Object
A map of option-value pairs to set.
Карта пар option-value (опция-значение) для установки.

Code examples: (Примеры кода: )
Invoke the method:
Запуск метода:
$( ".selector" ).menu( "option", { disabled: true } );
previous( [event ] )
Moves active state to previous menu item.

Перемещает активный статус к предыдущему пункту меню.

• event
Type: Event
What triggered the focus to move.
Какое событие заставляет фокус перемещаться.


Code examples: (Примеры кода: )
Invoke the previous method:
Запуск метода previous:
$( ".selector" ).menu( "previous" );



previousPage( [event ] )
Moves active state to first menu item above the top of a scrollable menu or the first item if not scrollable.

Перемещает активный статус к последнему пункту меню выше верха скроллируемого меню или к первому пункту нескроллируемого.

• event
Type: Event
What triggered the focus to move.
Какое событие заставляет фокус перемещаться.


Code examples: (Примеры кода: )
Invoke the previousPage method:
Запуск метода previousPage:
$( ".selector" ).menu( "previousPage" );



refresh()
Initializes sub-menus and menu items that have not already been initialized. New menu items, including sub-menus can be added to the menu or all of the contents of the menu can be replaced and then initialized with the refresh() method.
• This method does not accept any arguments.

Инициализирует под-меню и пункты Меню, которые еще не были инициализированы. Новые пункты меню, включая под-меню могут быть добавлены к меню или весь контент меню может быть замещен и затем проинициализирован методом refresh().
• Этот метод не принимает никаких аргументов.

Code examples: (Примеры кода: )
Invoke the refresh method:
Запуск метода refresh:
$( ".selector" ).menu( "refresh" );



select( [event ] )
Selects the currently active menu item, collapses all sub-menus and triggers the menu's select event.

Выбирает текущий активный пункт меню, закрывает все по-меню и триггирует событие меню.

• event
Type: Event
What triggered the selection.
Какое событие заставляет делать выбор.


Code examples: (Примеры кода: )
Invoke the select method:
Запуск метода select:
$( ".selector" ).menu( "select" );



widget()
Returns: jQuery
Returns a jQuery object containing the menu.
• This method does not accept any arguments.

Возвращает объект jQuery, содержащий Меню.
• Этот метод не принимает никаких аргументов.

Code examples: (Примеры кода: )
Invoke the widget method:
Запуск метода виджета:
var widget = $( ".selector" ).menu( "widget" );



Events (События)



blur( event, ui )
Type: menublur

Triggered when the menu loses focus.

• event
Type: Event

• ui
Type: Object
◦ item
Type: jQuery
The currently active menu item.

Code examples: (Примеры кода: )
Initialize the menu with the blur callback specified:
$( ".selector" ).menu({
    blur: function( event, ui ) {}
});


Bind an event listener to the menublur event:
$( ".selector" ).on( "menublur", function( event, ui ) {} );



create( event, ui )
Type: menucreate

Triggered when the menu is created.

• event
Type: Event

• ui
Type: Object

Code examples: (Примеры кода: )
Initialize the menu with the create callback specified:
$( ".selector" ).menu({
    create: function( event, ui ) {}
});


Bind an event listener to the menucreate event:
$( ".selector" ).on( "menucreate", function( event, ui ) {} );



focus( event, ui )
Type: menufocus

Triggered when a menu gains focus or when any menu item is activated.

• event
Type: Event

• ui
Type: Object
◦ item
Type: jQuery
The currently active menu item.

Code examples: (Примеры кода: )
Initialize the menu with the focus callback specified:
$( ".selector" ).menu({
    focus: function( event, ui ) {}
});


Bind an event listener to the menufocus event:
$( ".selector" ).on( "menufocus", function( event, ui ) {} );



select( event, ui )
Type: menuselect

Triggered when a menu item is selected.

• event
Type: Event

• ui
Type: Object
◦ item
Type: jQuery
The currently active menu item.

Code examples: (Примеры кода: )
Initialize the menu with the select callback specified:
$( ".selector" ).menu({
    select: function( event, ui ) {}
});


Bind an event listener to the menuselect event:
$( ".selector" ).on( "menuselect", function( event, ui ) {} );



Overview (Обзор)
A menu can be created from any valid markup as long as the elements have a strict parent/child relationship and each menu item has an anchor. The most commonly used element is the unordered list (<ul>)::

Меню может быть создано из любого валидного маркируемого списка до тех пор, пока элементы имеют строгое отношение родитель/ребенок и каждый пункт имеет якорь. Наиболее типичный используемый элемент есть список без порядковых номеров (<ul>):

<ul id="menu">
	<li><a href="#">Item 1</a></li>
	<li><a href="#">Item 2</a></li>
	<li><a href="#">Item 3</a>
		<ul>
			<li><a href="#">Item 3-1</a></li>
			<li><a href="#">Item 3-2</a></li>
			<li><a href="#">Item 3-3</a></li>
			<li><a href="#">Item 3-4</a></li>
			<li><a href="#">Item 3-5</a></li>
		</ul>
	</li>
	<li><a href="#">Item 4</a></li>
	<li><a href="#">Item 5</a></li>
</ul>


If you use a structure other than <ul>/<li>, including using the same element for the menu and the menu items, use the menus option to specify a way to differentiate the two elements, e.g., menus: "div.menuElement".

Если вы используете структуру иную чем <ul>/<li>, включая использование того же элемента для меню и для пункта меню, используйте опцию menus для определения способа задания разницы между двумя элементами, например, menus: "div.menuElement".

Any menu item can be disabled by adding the ui-state-disabled class to that element.

Любой пункт меню можно выключить путем добавления класса ui-state-disabled к данному элементу.

To add icons to the menu, include them in the markup:

Чтобы добавить иконки к меню, включите их в маркап:

<ul id="menu">
	<li><a href="#"><span class="ui-icon ui-icon-disk"></span>Save</a></li>
</ul>


Получится так:



Menu automatically adds the necessary padding to items without icons.

Меню автоматически добавит необходимые отступы к пунктам без иконок.


Keyboard interaction (Клавиши Клавиатуры)
• ENTER/SPACE: Invoke the focused menu item's action, which may be opening a submenu.
• UP: Move focus to the previous menu item.
• DOWN: Move focus to the next menu item.
• RIGHT: Open the submenu, if available.
• LEFT: Close the current submenu and move focus to the parent menu item. If not in a submenu, do nothing.
• ESCAPE: Close the current submenu and move focus to the parent menu item. If not in a submenu, do nothing.

• ENTER/SPACE: Запуск действия, связанного с текущим пунктом меню, это действия может быть открытием под-меню.
• UP: Перемещение фокуса на предыдущий пункт меню.
• DOWN: Перемещение фокуса на следующий пункт меню.
• RIGHT: Открытие под-меню, если оно есть.
• LEFT: Закрывает текущее под-меню и перемещает фокус на родительский пункт меню. Если нажатие не в под-меню, никаких действий не осуществляется.
• ESCAPE: Закрывает текущее под-меню и перемещает фокус на родительский пункт меню. Если нажатие не в под-меню, никаких действий не осуществляется.


Additional Notes (Дополнительная информация)
• This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point.
• Этот виджет требует определенных стилей CSS, иначе он не будет работать. Если вы используете адаптированную схему, оттолкитесь в своей разработке от специализированного файла CSS.


Example:



A simple jQuery UI Menu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>menu demo</title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
    <style>
    .ui-menu {
        width: 200px;
    }
    </style>
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
</head>
<body>
 
<ul id="menu">
    <li><a href="#">Item 1</a></li>
    <li><a href="#">Item 2</a></li>
    <li><a href="#">Item 3</a>
        <ul>
            <li><a href="#">Item 3-1</a></li>
            <li><a href="#">Item 3-2</a></li>
            <li><a href="#">Item 3-3</a></li>
            <li><a href="#">Item 3-4</a></li>
            <li><a href="#">Item 3-5</a></li>
        </ul>
    </li>
    <li><a href="#">Item 4</a></li>
    <li><a href="#">Item 5</a></li>
</ul>
 
<script>
$( "#menu" ).menu();
</script>
 
</body>
</html>
Этот пример можно посмотреть здесь.



Примеры Меню на этом сайте: Дефолтное, Иконки.



Если вы планируете вернуться сюда позднее...
Пожалуйста, запомните эту страничку -
URL: http://kocby.ru/post/webmaster/jquery/ui/menu/
Спасибо за посещение этой странички и внимательное отношение к ее контенту и дизайну. Удачи и успеха!
© KOCBY.RU :: перепечатка материалов разрешается с указанием ссылки на домен KOCBY.RU ©
Basket is empty :: Корзина пустая
Close and hide in basket :: Закрыть и спрятать в корзину
Посмотри в зеркало! Что там видно?
Красивая девушка брюнетка слева Красивая девушка блондинка справа




Close and hide in basket :: Закрыть и спрятать в корзину статистическую информацию о посетителях Клуба.
Створки зеркала Клуба Одиноких Сердец.
Красивая девушка блондинка слева Красивая девушка брюнетка справа