How to extend
Erweiterung JS per mixin Beispiel
require-config.js
let config = {
"config": {
"mixins": {
"TechDivision_EnhancedMenu/js/enhanced-menu": {
"AngelaBruderer_Menu/js/extended-enhanced-menu": true
}
}
}
};
extended-enhanced-menu.js
define([
'jquery',
], function ($) {
'use strict';
return function (widget) {
$.widget('techdivision.enhancedMenu', widget, {
options: {
here it is possible to overwrite options with new values
},
mobileMode: function () {
this._super();
// this extends the mobileMode function with a new on click event for mobile
let widget = this;
// close trigger for mobile menu section
this.options.navClose.on('click.mobile touchstart.mobile', function (e) {
widget.options.navSection.removeClass('opened');
widget.disableMenuBgLayer();
widget.mobileToggleBodyScroll();
e.preventDefault();
});
}
});
// noinspection JSUnresolvedVariable
return $.techdivision.enhancedMenu;
}
});