From 3ee5ae67f99be92a2280ae96bcfd0b8e999c2222 Mon Sep 17 00:00:00 2001 From: Ben Kamens Date: Sat, 20 Apr 2013 09:20:44 -0700 Subject: [PATCH 1/5] If a submenu is clicked, immediately activate it. --- example/example.html | 8 ++++++++ jquery.menu-aim.js | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/example/example.html b/example/example.html index b9938c1..0df8388 100644 --- a/example/example.html +++ b/example/example.html @@ -240,6 +240,14 @@

jQuery-menu-aim example

$row.find("a").removeClass("maintainHover"); } + // Bootstrap's dropdown menus immediately close on document click. + // Don't let this event close the menu if a submenu is being clicked. + // This event propagation control doesn't belong in the menu-aim plugin + // itself because the plugin is agnostic to bootstrap. + $(".dropdown-menu li").click(function(e) { + e.stopPropagation(); + }); + $(document).click(function() { // Simply hide the submenu on any click. Again, this is just a hacked // together menu/submenu structure to show the use of jQuery-menu-aim. diff --git a/jquery.menu-aim.js b/jquery.menu-aim.js index b06f888..0c32941 100644 --- a/jquery.menu-aim.js +++ b/jquery.menu-aim.js @@ -147,6 +147,13 @@ options.exit(this); }; + /* + * Immediately activate a row if the user clicks on it. + */ + var clickRow = function() { + activate(this); + }; + /** * Activate a menu row. */ @@ -306,7 +313,9 @@ .mouseleave(mouseleaveMenu) .find(options.rowSelector) .mouseenter(mouseenterRow) - .mouseleave(mouseleaveRow); + .mouseleave(mouseleaveRow) + .click(clickRow); + $(document).mousemove(mousemoveDocument); }; From a6826ab4f4aef204f862d502e829f73f90e6116f Mon Sep 17 00:00:00 2001 From: Ben Kamens Date: Sun, 7 Jul 2013 09:41:06 -0700 Subject: [PATCH 2/5] Trying to fix htmlpreview.github.io demo's willingness to execute javascript --- example/example.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example/example.html b/example/example.html index 0df8388..c81ede4 100644 --- a/example/example.html +++ b/example/example.html @@ -192,9 +192,9 @@

jQuery-menu-aim example

- - - + + +