多级推送菜单,我让默认打开,我怎么让默认关闭移动端

Multi-level push menu, I made the default open, how do I make the default closed for mobile?

本文关键字:默认 移动 多级 菜单      更新时间:2023-09-26

我在创建WordPress主题中使用这个多级推送菜单:http://tympanus.net/Development/MultiLevelPushMenu/index2.html

建议将代码更改为true,如下所示:

_init : function() {

…这一点。Open = true;

但是这不起作用,所以另一个关于堆栈溢出的帖子说要改变代码并添加这个,见下面:

function mlPushMenu( el, trigger, options ) {
this.el = el;
this.trigger = trigger;
this.options = extend( this.defaults, options );
// support 3d transforms
this.support = Modernizr.csstransforms3d;
if( this.support ) {
    this._init();
    this._openMenu();  // added
}

}

这工作。但我如何改变默认关闭我的移动视图900px或更小?

我终于想通了。这里是答案,如果有人需要的话。

function mlPushMenu( el, trigger, options ) {   
    this.el = el;
    this.trigger = trigger;
    this.options = extend( this.defaults, options );
    // support 3d transforms
    this.support = Modernizr.csstransforms3d;
    if( this.support ) {
        this._init();
        if($(window).width() >= 991){
        this._openMenu();  // added
        }
    }
}