【问题标题】:Can't get mmenu plug-in mhead sticky header to work无法让 mmenu 插件 mhead 粘头工作
【发布时间】:2020-06-29 23:00:42
【问题描述】:

我正在尝试使用 mmenu 插件中的粘性标头,但无法正常工作。

    <script src="./mmenu.js"></script>
    <script src="./mhead.js"></script>
    <script>
        Mmenu.configs.classNames.selected = "active";
        Mmenu.configs.offCanvas.page.selector = "#my-page";

        document.addEventListener(
            "DOMContentLoaded", () => {
                const menu = new Mmenu( "#my-menu", {
                    slidingSubmenus: false,
                    extensions: ["theme-dark"],
                    "iconbar": {
                      "use": true,
                      "top": [
                         "<a href='#/'><i class='fa fa-home'></i></a>",
                         "<a href='#/'><i class='fa fa-user'></i></a>"
                      ],
                      "bottom": [
                         "<a href='#/'><i class='fa fa-twitter'></i></a>",
                         "<a href='#/'><i class='fa fa-facebook'></i></a>",
                         "<a href='#/'><i class='fa fa-linkedin'></i></a>"
                      ]
                   },
                   "navbars": [
                      {
                         "position": "top",
                         "content": [
                            "searchfield"
                         ]
                      }
                   ]
                });
            }
        );
        document.addEventListener(
            "DOMContentLoaded", () => {
                new mhead( "#my-header", {
                    pin: 100
                });
            }
        );
    </script>

当我运行它时,我不断收到 index.html:121 Uncaught ReferenceError: mhead is not defined 在 HTMLDocument。

谁有这个js插件的经验? https://www.mmenujs.com/mhead/tutorial.html 一切正常,除了粘性标题。

【问题讨论】:

    标签: mmenu


    【解决方案1】:

    改成

    new Mhead 
    

    (注意大写M)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-26
      相关资源
      最近更新 更多