item
The menu item on which the event occurred.
Description
The menu item on which the event occurred.
Type:
NAME
TYPE
DESCRIPTION
The label of the menu item. This is text that the site visitor sees in the menu and can click to navigate.
If not specified, and the page that the link property references is:
- An external page or an empty string: The menu defaults to the menu items based on site pages only, as defined in the Editor, and an error is logged to the console.
- A page nested under a folder: The specific menu item label defaults to the name of the corresponding page as defined in the Editor.
- A regular, non-nested, site page: The
label
for the menu item gets its value from the name of the page that thelink
property references.
Min: 1 character
Max: 40 characters
Setting selected
to true
for a menu item causes the item to appear highlighted in the menu element.
You can use this property to indicate which page is currently being displayed.
Note: The value of
selected
isn't validated against which page is actually displayed. For example, you can write code that misleadingly setsselected
totrue
for multiple menu items.
When not defined explicitly using the selected
property, the selected
value is derived from the currently-active page in the site's main menu
(as defined when managing the menu in the Editor) and not derived from a currently-active page in a custom menu.
Default: false
Optional link for the menu item. This is the link the site visitor navigates to when they click on a menu item. The different types of links you can use are:
/localPageURL
: Another page on your site, such as/about
or/rentals/shortterm
./
: Your site's home page.http(s)://<url>
: An external web address, such ashttps://www.mortgagecalculator.org/
.wix:document://<location>
: A document stored in the Media Manager, such aswix:document://v1/9bec_52fb06ea/filename.xls
.mailto:<email-address>?subject=<subject>
: An email, such asmailto:michael@example.com?subject=Coming%20Soon
.tel:<phone number>
: A phone number, such astel:+1-555-555-5555
.
If link
isn't specified, the corresponding label isn't clickable.
Specifying an empty string is not supported. The menu defaults to the menu items as defined in the Editor and an error is logged to the console.
Min: 1 character
Max: 40 characters
Whether the link opens in the same window/tab or in a new window/tab.
_self
. The page opens in the same window/tab._blank
. The page opens in a new window/tab.
Note:
target
doesn't work when previewing your site.
Default: _self
Menus can have additional levels of submenus. Vertical menus can have 1 level of submenus. Horizontal menus can have 2 additional levels of submenus.
A unique ID that can be used to customize events triggered on a menu item. For example, when a visitor clicks a menu item, the ID can be checked in order to trigger the appropriate action for that menu item.
Was this helpful?
XXX
1$w("#myElement").onClick( (event) => {2 let clientX = event.clientX; // 3623 let clientY = event.clientY; // 2444 let offsetX = event.offsetX; // 105 let offsetY = event.offsetY; // 126 let pageX = event.pageX; // 3627 let pageY = event.pageY; // 3768 let screenX = event.screenX; // 38979 let screenY = event.screenY; // 36210} );