I'm trying to disable sliding submenus in my mobile menu by adding the following code to a js file that I implemented in my theme:
jQuery(document).ready(function( $ ) {
$("#off-canvas").mmenu({
"slidingSubmenus": false
});
});Unfortunately it has no effect. What am I doing wrong?
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | how_to_change_options-2845109-10.patch | 5.34 KB | kunalkursija |
| #10 | Screen Shot 2017-06-13 at 4.16.53 PM.png | 51.06 KB | kunalkursija |
Comments
Comment #2
tancAs it stands now the options are hard coded in responsive_menu.js. You can get the mmenu object and modify it with something like this
var mmenu = $('#off-canvas').data('mmenu');but I don't think you can change the initial options once the mmenu is instantiated. Your code would only work if creating a new instance of mmenu.One solution would be to add an option in the module UI to reflect that mmenu option you want to modify. That's already happening for the position and theme, so it wouldn't be too much trouble to add for the slidingSubmenus option. I'll turn this into a feature request.
Comment #3
johnnny83 commentedHm, it doesn't work, but my JavaScript knowledge is also not the best (shame on me).
I don't want to patch modules, so I'll have to wait till it is implemented. It wouldn't be a bad idea to also add all the other possible options, so you can fully profit from the library. It would also be interesting to change it to on-canvas.
Comment #4
ConradFlashback commentedIt's easy. The file isn't responsive_menu.js but responsive_menu.config.js in js folder.
Line 25 from
extensions: [theme, 'effect-slide-menu'],
to
extensions: [theme, 'effect-slide-menu','fullscreen','iconbar','effect-menu-zoom','popup'],
There is the updating modules big problem with this solution.
A simple text field in admin with variables cut and paste would be great.
A completely fieldable structure with all extensions/options would be perfect ;)
Bye.
Comment #5
tancPatches are welcome!
Comment #6
kunalkursija commented@tanc: I am working on this patch.
Comment #7
kunalkursija commentedI have added a screenshot of updated UI option.
Adding Patch.
Comment #8
kunalkursija commentedHi @tanc,
I have noticed that the zposition property is also hard-coded and 'mmenu' provides some position configurations too.
I will work on the functionality and combine the below functionalities in a single patch:
Reference: http://mmenu.frebsite.nl/documentation/extensions/positioning.html
Thanks,
Comment #9
tancGreat work so far! :)
Will review properly once you've completed the next part.
Comment #10
kunalkursija commented@tanc - Adding patch for the below functionalities:
Please review and let me know if you find any issues.
Welcome:) By the way, this is one nice module to have on a site!
Thanks,
Comment #11
steve.colson commentedPatch no longer cleanly applies to 8.x-2.6
Comment #12
tancThere is an interesting patch in this issue #2955215: Allow extension/override of mmenu settings. I like the approach of that issue as it keeps this module from trying to cover all possible options and instead allows an advanced themer to introduce their own overrides.
Comment #13
tancComment #14
tancClosing this as there will be a solution in the 8.x-3.x branch when released.