-
Notifications
You must be signed in to change notification settings - Fork 212
move menu icon out of h2 tags and let it trigger the menu #185
Comments
Hey Alex,
Take a look at example here. |
I set up a new Icon to expand the menu with this code
Can't seem to trigger the collapse with the same element though. |
|
The code you posted looks good, but it only collapses the menu. |
You're right
|
Works perfectly thank you very much for your help! |
Do you have a demo of this working? would love to see. Also would be good to have the category text appear running down the menu stripe instead of just the icon clickable |
You have examples of invoking menu events by clicking on external DOM elements here. I agree, category text appear running down the menu stripe would be nice..., but I didn't work much on it after I have developed it ~5 years ago... :( |
I want to click the whole bar to collapse it also.
… On 5 Feb 2018, at 20:22, Momcilo Dzunic ***@***.***> wrote:
You have examples of invoking menu events by clicking on external DOM elements here.
Menu collapsing/expanding is an simpler example comparing to that.
I agree, category text appear running down the menu stripe would be nice..., but I didn't work much on it after I have developed it ~5 years ago... :(
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
No demo but here's my code. I added an overlay as well. The only problem I've come across if if you swipe the menu or use a method to close the menu by clicking the body it doesn't toggle the classes off and leaves everything mixed up. So I've had to disable swiping and exiting by clicking on the body for now.
|
This old version https://tympanus.net/Development/MultiLevelPushMenu/# lets you click the whole bar to collapse that section - we have to click the small h2 icon at the top to close it down, can somone give a code so it will work like the demo above? |
Hey Wayne, You can achieve this by making simple tweak (as follow)...
Regards |
That works great ! I have adaped it to use a class instead of inline css but perfect. It does duplicate the close area div many times which is a small bug here but in general that works for now. |
I am glad to hear that :) Instead of
use following
to make sure 'close-areas' are removed completely... |
I am not sure what the question is... If it is about vertical title you can try something like following.
|
You've done it again :) amazing 👍 Just a small small issue when going back in the menu, the span stays there too long and overlaps the menu a little bit. see video here to explain - https://ufile.io/1ztzv (sorry for free mp4 upload hosting here GIT doesnt support mp4) |
I didn't download the video but I guess I understand the issue. At line 636 replace
with following
This will expose collapse level as second argument in onCollapseMenuStart event callback. Now add onCollapseMenuStart callback in your code as follows.
That's it. |
You're a magician. That works beautifully and i cant thank you enough. |
Unfortunately css
|
@adgsm Hey. I know this is an old thread, but I'm trying to implement the code you suggested here: function makeCloseArea(){ etc… I cannot make it work at all! Where exactly should I be inserting this code? Should the function and the document.ready be split up into different files? I have tried putting it in expandcollapse.js , jquery.multilevelpushmenu.min.js, or even my html page. Could you please show a working example? Such a great menu – thank you! Tim |
@waynep16 Sorry to bother you with an old thread. Would you still have the 'whole-bar collapse' code for the mlp menu? I can't get the owner's code to work at all. A working example to examine would be great. Many thanks. |
@rivertim I added the code under my original MMmenu call from here to make the whole bar close on click of whole bar.... |
@waynep16 Hey. Thanks for the speedy reply! :) Sorry to be thick, but I don't see your code. I see the owner's suggested code – which I just can't make work! Maybe I'm missing something simple here. Would you by any chance have the complete code of your working example? |
Code was on that comment but i think you need to add the following CSS Also ` .close-area {
|
@waynep16 Wayne, thanks for the css. But I still don't see the js code attached to any of your comments in this thread. Am I missing something? |
Its in this comment here
|
@waynep16 This? I thought this was the creator of the menu's code? function makeCloseArea(){ ' );
$closeArea.css( 'position' , 'absolute' ); $closeArea.css( 'right' , 0 ); $closeArea.css( 'top' , 0 ); $closeArea.css( 'width' , '40px' ); $closeArea.css( 'height' , '100%' ); $closeArea.css( 'cursor' , 'pointer' ); $closeArea.on( 'click' , function( event ){ $( this ).parents( '.levelHolderClass.multilevelpushmenu_inactive' ).first().find( 'h2 > i' ).first().trigger( 'click' ) } ); $inactiveMenus.append( $closeArea ); } $(document).ready(function(){ $( '#menu' ).multilevelpushmenu({ onExpandMenuEnd: function(){ makeCloseArea(); }, onCollapseMenuEnd: function(){ makeCloseArea(); } }); }); If so, I can't make this work at all! Not sure whether this code should be in the main js file or in the html source. Any pointers would be appreciated. Thanks. |
Thats it... it goes below where you are calling the main menu code |
@waynep16 In the jquery.multilevelpushmenu.min.js or my html page? |
@waynep16 Thanks for your help, but I can't get this code working wherever I put it. It never creates the vital .close-area div in the source… If you have a moment sometime I'd love to see a working example of this! |
The site this was for is no longer in production but literally i pasted the code above and it worked 1st time (providing the initial set up was working fine initially ) |
@waynep16 Thanks for your help anyway. My existing setup is also working fine. But when I add the code above it doesn't function as it should. C'est la vie! |
I want to move the menu icon out of the h2 tags so I can position it where I want and add styling outside of the wrapper. Whenever it is moved outside the h2 tags it no longer triggers the menu.
The text was updated successfully, but these errors were encountered: