From c98a809aa511229750fdcaec5db37ac6fb320a67 Mon Sep 17 00:00:00 2001 From: Ben Kamens Date: Tue, 26 Mar 2013 21:31:28 -0700 Subject: [PATCH 1/7] Move example's submenu contents into HTML structure of menu itself so new exitMenu event fires at proper times in example. --- example/example.html | 152 +++++++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 62 deletions(-) diff --git a/example/example.html b/example/example.html index d2f934b..e4f9b03 100644 --- a/example/example.html +++ b/example/example.html @@ -50,6 +50,17 @@ max-width: 250px; } + .dropdown-menu { + -webkit-border-top-right-radius: 0px; + -webkit-border-bottom-right-radius: 0px; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; + + -webkit-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); + box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); + } + .dropdown-menu > li > a:hover { background-image: none; color: white; @@ -83,7 +94,6 @@ @@ -117,53 +192,6 @@

jQuery-menu-aim example

- - - - - - - - - - - - @@ -187,15 +215,14 @@

King Colobus

var $row = $(row), submenuId = $row.data("submenuId"), $submenu = $("#" + submenuId), - offset = $menu.offset(), height = $menu.outerHeight(), width = $menu.outerWidth(); // Show the submenu $submenu.css({ display: "block", - top: offset.top, - left: offset.left + width - 5, // main should overlay submenu + top: -1, + left: width - 3, // main should overlay submenu height: height - 4 // padding for main dropdown's arrow }); @@ -217,6 +244,7 @@

King Colobus

// 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. $(".popover").css("display", "none"); + $("a.maintainHover").removeClass("maintainHover"); }); From 1737981130341232c64cfa2a50349a1c9537e6c6 Mon Sep 17 00:00:00 2001 From: Ben Kamens Date: Tue, 26 Mar 2013 21:45:15 -0700 Subject: [PATCH 2/7] Make sure example page's overridden styles are more specific than vanilla boostrap's --- example/example.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/example/example.html b/example/example.html index e4f9b03..b9938c1 100644 --- a/example/example.html +++ b/example/example.html @@ -32,7 +32,7 @@ You can choose to do whatever you want w/ those events. --> - .popover { + .navbar .popover { width: 400px; -webkit-border-top-left-radius: 0px; -webkit-border-bottom-left-radius: 0px; @@ -41,16 +41,16 @@ overflow: hidden; } - .popover-content { + .navbar .popover-content { text-align: center; } - .popover-content img { + .navbar .popover-content img { height: 212px; max-width: 250px; } - .dropdown-menu { + .navbar .dropdown-menu { -webkit-border-top-right-radius: 0px; -webkit-border-bottom-right-radius: 0px; border-top-right-radius: 0px; @@ -61,14 +61,14 @@ box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); } - .dropdown-menu > li > a:hover { + .navbar .dropdown-menu > li > a:hover { background-image: none; color: white; background-color: rgb(0, 129, 194); background-color: rgba(0, 129, 194, 0.5); } - .dropdown-menu > li > a.maintainHover { + .navbar .dropdown-menu > li > a.maintainHover { color: white; background-color: #0081C2; } From 3ee5ae67f99be92a2280ae96bcfd0b8e999c2222 Mon Sep 17 00:00:00 2001 From: Ben Kamens Date: Sat, 20 Apr 2013 09:20:44 -0700 Subject: [PATCH 3/7] 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 4/7] 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

- - - + + + var $menu = $(".dropdown-menu"); From 335fc24036ef4f49058292ea7b6b7e033e22cc36 Mon Sep 17 00:00:00 2001 From: Ben Kamens Date: Sun, 7 Jul 2013 09:46:17 -0700 Subject: [PATCH 5/7] Use rawgithub.com for quick demo rendering (it properly handles mime types) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0708e27..d4b39d1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ menu-aim is a jQuery plugin for dropdown menus that can differentiate between a user trying hover over a dropdown item vs trying to navigate into a submenu's contents. -[Try a demo.](http://htmlpreview.github.com/?https://github.com/kamens/jQuery-menu-aim/blob/master/example/example.html) +[Try a demo.](https://rawgithub.com/kamens/jQuery-menu-aim/master/example/example.html) ![Amazon screenshot](https://raw.github.com/kamens/jQuery-menu-aim/master/amazon.png) From 86ac9a0782ebc417b50114c2475f2a4b106cf121 Mon Sep 17 00:00:00 2001 From: Ben Kamens Date: Fri, 19 Jul 2013 01:08:11 -0700 Subject: [PATCH 6/7] Fix another link to demo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d4b39d1..3cc02b9 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ dropdown item *and* when that item is being intentionally hovered over. ## Want an example to learn from? -Check out example/example.html -- it has [a working dropdown for you to play with](http://htmlpreview.github.com/?https://github.com/kamens/jQuery-menu-aim/blob/master/example/example.html): +Check out example/example.html -- it has [a working dropdown for you to play with](https://rawgithub.com/kamens/jQuery-menu-aim/master/example/example.html): ![Example screenshot](https://raw.github.com/kamens/jQuery-menu-aim/master/example.png)
_Play with the above example full of fun monkey pictures by opening example/example.html after downloading the repo._ From da3cb657f36a1876d6a34514ad1fb81f1dd2433c Mon Sep 17 00:00:00 2001 From: Ben Kamens Date: Wed, 3 Dec 2014 11:16:00 -0800 Subject: [PATCH 7/7] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3cc02b9..cb5292c 100644 --- a/README.md +++ b/README.md @@ -81,4 +81,5 @@ _Play with the above example full of fun monkey pictures by opening example/exam 1. What's the license? [MIT](http://en.wikipedia.org/wiki/MIT_License). 2. Does it support horizontal menus or submenus that open to the left? Yup. Check out the submenuDirection option above. -3. I'm not nearly bored enough. Got anything else? [Read about this plugin's creation](http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown). +3. I work at a big company that requires a version number on this third party code before I can use it. Do you have a version number? Sure, current version: 1.1 +4. I'm not nearly bored enough. Got anything else? [Read about this plugin's creation](http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown).