diff --git a/README.md b/README.md index a40a62a..7cb5bb9 100755 --- a/README.md +++ b/README.md @@ -2,6 +2,34 @@ 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. + +index2.html contains this new use case: + + + + +Orig README:: +======== + 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) 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() {