From e3b36bedc62e186b5c95d01a3c893ae2e7993701 Mon Sep 17 00:00:00 2001 From: Scott Roberson Date: Tue, 24 Nov 2015 15:51:37 -0500 Subject: [PATCH 1/5] added ability to specify an alternate trigger; added onNavOpen & onNavClosed callbacks; updated index2.html to demonstrate new functionality. --- index2.html | 22 ++++++++++++++++------ js/jquery.dlmenu.js | 13 +++++++++---- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/index2.html b/index2.html index 9a687a5..fdc9212 100755 --- a/index2.html +++ b/index2.html @@ -2,26 +2,26 @@ - - + + Responsive Multi-Level Menu - Demo 2 - + -
+
-

Responsive Multi-Level Menu Space-saving drop-down menu with subtle effects

+

Responsive Multi-Level Menu Space-saving drop-down menu with subtle effects

+ +

@@ -143,8 +145,16 @@

Responsive Multi-Level Menu Space-saving drop-down menu with subtle ef diff --git a/js/jquery.dlmenu.js b/js/jquery.dlmenu.js index dec44e4..80a4075 100755 --- a/js/jquery.dlmenu.js +++ b/js/jquery.dlmenu.js @@ -26,10 +26,12 @@ animationClasses : { classin : 'dl-animate-in-1', classout : 'dl-animate-out-1' }, // callback: click a link that has a sub menu // el is the link element (li); name is the level name - onLevelClick : function( el, name ) { return false; }, + onLevelClick : function( el, name ) {return false; }, // callback: click a link that does not have a sub menu // el is the link element (li); ev is the event obj - onLinkClick : function( el, ev ) { return false; }, + onLinkClick : function( el, ev ) {return false; }, + onNavOpened : function() {return false; }, + onNavClosed : function() {return false; }, backLabel: 'Back', // Change to "true" to use the active item as back link label. useActiveItemAsBackLabel: false, @@ -37,7 +39,8 @@ // menu. useActiveItemAsLink: false, // On close reset the menu to root - resetOnClose: true + resetOnClose: true, + triggerEl: "" }; $.DLMenu.prototype = { @@ -74,7 +77,7 @@ }, _config : function() { this.open = false; - this.$trigger = this.$el.children( '.dl-trigger' ); + this.$trigger = this.options.triggerEl || this.$el.children( '.dl-trigger' ); this.$menu = this.$el.children( 'ul.dl-menu' ); this.$menuitems = this.$menu.find( 'li:not(.dl-back)' ); this.$el.find( 'ul.dl-submenu' ).prepend( '
  • ' + this.options.backLabel + '
  • ' ); @@ -221,6 +224,7 @@ } this.open = false; + self.options.onNavClosed(); }, openMenu : function() { if( !this.open ) { @@ -238,6 +242,7 @@ } ); this.$trigger.addClass( 'dl-active' ); this.open = true; + self.options.onNavOpened(); }, // resets the menu to its original state (first level of options) _resetMenu : function() { From 5cbf94d6279742d98d81eefecef0c64586217aaf Mon Sep 17 00:00:00 2001 From: Scott Roberson Date: Tue, 24 Nov 2015 16:05:06 -0500 Subject: [PATCH 2/5] updated Readme --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index a40a62a..433bd28 100755 --- a/README.md +++ b/README.md @@ -2,6 +2,13 @@ ResponsiveMultiLevelMenu ========= +This is a forked version of this library. + +I changed it to allow for an alternate $trigger (jQuery collection). + +I also added onNavOpened() and onNavClosed() callbacks to allow for running code after these events occur. + + A responsive multi-level menu that shows its submenus in their own context, allowing for a space-saving presentation and usage. [article on Codrops](http://tympanus.net/codrops/?p=14753) From 42e844967146d2f439d93f883fff21dc69eada2b Mon Sep 17 00:00:00 2001 From: Scott Roberson Date: Tue, 24 Nov 2015 16:05:51 -0500 Subject: [PATCH 3/5] tweaked README --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 433bd28..5a2797e 100755 --- a/README.md +++ b/README.md @@ -9,6 +9,10 @@ I changed it to allow for an alternate $trigger (jQuery collection). I also added onNavOpened() and onNavClosed() callbacks to allow for running code after these events occur. + +Orig README:: ResponsiveMultiLevelMenu +======== + A responsive multi-level menu that shows its submenus in their own context, allowing for a space-saving presentation and usage. [article on Codrops](http://tympanus.net/codrops/?p=14753) From b890b8cefe42ed2af81426b9557fa84661a97b77 Mon Sep 17 00:00:00 2001 From: Scott Roberson Date: Tue, 24 Nov 2015 16:07:18 -0500 Subject: [PATCH 4/5] added example code --- README.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5a2797e..6fffcad 100755 --- a/README.md +++ b/README.md @@ -8,9 +8,26 @@ I changed it to allow for an alternate $trigger (jQuery collection). I also added onNavOpened() and onNavClosed() callbacks to allow for running code after these events occur. - - -Orig README:: ResponsiveMultiLevelMenu +The example use of this file is contained in index2.html: + + + + +Orig README:: ======== A responsive multi-level menu that shows its submenus in their own context, allowing for a space-saving presentation and usage. From 7c59b45f8e0f28b0acb9d10758e8d883d182e207 Mon Sep 17 00:00:00 2001 From: Scott Roberson Date: Tue, 24 Nov 2015 16:08:04 -0500 Subject: [PATCH 5/5] tweak --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6fffcad..7cb5bb9 100755 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ I changed it to allow for an alternate $trigger (jQuery collection). I also added onNavOpened() and onNavClosed() callbacks to allow for running code after these events occur. -The example use of this file is contained in index2.html: +index2.html contains this new use case: