Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions jquery.menu-aim.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@
exit: $.noop,
activate: $.noop,
deactivate: $.noop,
exitMenu: $.noop
exitMenu: $.noop,
exitDelay: 0
}, opts);

var MOUSE_LOCS_TRACKED = 3, // number of past mouse locations to track
DELAY = 300; // ms delay when user appears to be entering submenu

var mouseleaveTimer;

/**
* Keep track of the last few locations of the mouse.
*/
Expand All @@ -120,15 +123,16 @@
clearTimeout(timeoutId);
}

// If exitMenu is supplied and returns true, deactivate the
// currently active row on menu exit.
if (options.exitMenu(this)) {
if (activeRow) {
options.deactivate(activeRow);
mouseleaveTimer = window.setTimeout(function () {
// If exitMenu is supplied and returns true, deactivate the
// currently active row on menu exit.
if (options.exitMenu(this)) {
if (activeRow) {
options.deactivate(activeRow);
}
activeRow = null;
}

activeRow = null;
}
}, options.exitDelay);
};

/**
Expand All @@ -140,6 +144,8 @@
clearTimeout(timeoutId);
}

window.clearTimeout(mouseleaveTimer);

options.enter(this);
possiblyActivate(this);
},
Expand Down