new Responsiville.Mobimenu(options)
Creates and initialises the mobile menu.
Name | Type | Description |
---|---|---|
options |
Object | The initialisation options of the module. |
- License:
- Nevma Copyright (c) http://www.nevma.gr
Properties:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | The options that define the object
behaviour.
Properties
|
Fires:
Extends
Members
-
staticResponsiville.Mobimenu.AUTO_RUN
-
Properties:
Name Type Description AUTO_RUN
boolean Controls whether this module should run by default, without the developer calling it, using its default settings. Defaults to true. -
staticResponsiville.Mobimenu.defaults
-
Properties:
Name Type Description defaults
Object Default values for this module settings.
Methods
-
staticResponsiville.Mobimenu.autoRun(){void}
-
Runs through the page and searches for elements that apply to the current module in order to apply it to them automatically. Useful for automatically creating elements with this module's behaviour just by setting up the predefined classes and data attributes in HTML elements of the page.
Returns:
Type Description void -
anchorHashClick(event){boolean}
-
Handles the click event on an anchor element inside the mobimenu which has an internal link, ie starts with a "#". If the anchor points to an existing element then the menu is closed so that the page can be scrolled to that element.
Name Type Description event
Event The mouse click event that fired. Returns:
Type Description boolean Whether the event should propagate and allow default behaviour. -
close(event){void}
-
Closes the mobimenu. Actually closes and shows the mobimenu with the required visual effect.
Name Type Description event
Event The event that fired on the element which closes the mobimenu. Fires:
Returns:
Type Description void -
closeButtonClick(){boolean}
-
Handles the click event on the mobimenu close button. The menu is closed and the handler always returns false to stop default behaviour.
Returns:
Type Description boolean Whether the event should propagate and allow default behaviour. -
disable(){void}
-
Disables the mobimenu. It does not deactivate it, it does not close it. It simply disables it, so it does not function any more when the necessary trigger is fired. Useful in responsive design where the mobimenu might be a required feature in desktops but useless in mobile devices.
Returns:
Type Description void -
enable(){void}
-
Enables the mobimenu. It does not activate it, it does not open it. It simply enables it, so when the necessary trigger is fired (ie the burger menu is tapped) then the menu is activated (which means it opens). Useful in responsive design where the mobimenu might be a required feature in desktops but useless in mobile devices.
Returns:
Type Description void -
escapeKeyUp(event){boolean}
-
Handles the escape key up event to close the mobimenu via the keyboard when it is open. One could argue thath it is pointless in mobile devices, but burger menus have been used in desktop devices often as well.
Name Type Description event
Event The event that fired on the keyboard. Returns:
Type Description boolean Whether the event should propagate and allow default behaviour. -
menuContainerClick(event){boolean}
-
Handles the click event on the mobimenu container body. The menu is closed and the handler always returns false to stop default behaviour.
Name Type Description event
Event The mouse click event that fired. Returns:
Type Description boolean Whether the event should propagate and allow default behaviour. -
open(){void}
-
Opens the mobimenu. Actually opens and shows the mobimenu with the required visual effect.
Fires:
Returns:
Type Description void -
openButtonClick(){boolean}
-
Handles the click event on the mobimenu open butoon. The menu opens and the handler always returns true.
Returns:
Type Description boolean Whether the event should propagate and allow default behaviour. -
setupEvents(){void}
-
Sets up event handlers necessary for the object to function properly.
Returns:
Type Description void
Events
-
closed
-
Called after the mobimenu has been closed.
-
closing
-
Called before the mobimenu has started closing.
-
Called after the mobimenu has been created.
-
opened
-
Called after the mobimenu has been opened.
-
opening
-
Called before the mobimenu has started opening.