@@ -5,24 +5,52 @@ menu-aim is a jQuery plugin for dropdown menus that can differentiate
5
5
between a user trying hover over a dropdown item vs trying to navigate into
6
6
a submenu's contents.
7
7
8
- menu-aim assumes that you have are using a menu with submenus that expand
8
+ menu-aim assumes that you are using a menu with submenus that expand
9
9
to the menu's right. It will fire events when the user's mouse enters a new
10
10
dropdown item * and* when that item is being intentionally hovered over.
11
11
12
- __________________________
13
- | Monkeys >| Gorilla |
14
- | Gorillas >| Content |
15
- | Chimps >| Here |
16
- | ___________ | ____________ |
17
-
18
- In the above example, "Gorillas" is selected and its submenu content is
19
- being shown on the right. Imagine that the user's cursor is hovering over
20
- "Gorillas." When they move their mouse into the "Gorilla Content" area, they
21
- may briefly hover over "Chimps." This shouldn't close the "Gorilla Content"
22
- area.
12
+ ![ Amazon screenshot] ( https://raw.github.com/kamens/jQuery-menu-aim/master/amazon.png )
23
13
24
14
This problem is normally solved using timeouts and delays. menu-aim tries to
25
15
solve this by detecting the direction of the user's mouse movement. This can
26
16
make for quicker transitions when navigating up and down the menu. The
27
17
experience is hopefully similar to amazon.com/'s "Shop by Department"
28
18
dropdown.
19
+
20
+ Use like so:
21
+
22
+ $("#menu").menuAim({
23
+ activate: $.noop, // fired on row activation
24
+ deactivate: $.noop, // fired on row deactivation
25
+ });
26
+
27
+ ...to receive events when a menu's row has been purposefully (de)activated.
28
+
29
+ The following options can be passed to menuAim. All functions execute with
30
+ the relevant row's HTML element as the execution context ('this'):
31
+
32
+ .menuAim({
33
+ // Function to call when a row is purposefully activated. Use this
34
+ // to show a submenu's content for the activated row.
35
+ activate: function() {},
36
+
37
+ // Function to call when a row is deactivated.
38
+ deactivate: function() {},
39
+
40
+ // Function to call when mouse enters a menu row. Entering a row
41
+ // does not mean the row has been activated, as the user may be
42
+ // mousing over to a submenu.
43
+ enter: function() {},
44
+
45
+ // Function to call when mouse exits a menu row.
46
+ exit: function() {},
47
+
48
+ // Selector for identifying which elements in the menu are rows
49
+ // that can trigger the above events. Defaults to "> li".
50
+ rowSelector: "> li",
51
+
52
+ // You may have some menu rows that aren't submenus and therefore
53
+ // shouldn't ever need to "activate." If so, filter submenu rows w/
54
+ // this selector. Defaults to "*" (all elements).
55
+ submenuSelector: "*"
56
+ });
0 commit comments