检测jQuery MMenu是否处于打开/活动状态?

编程入门 行业动态 更新时间:2024-10-23 19:28:27
本文介绍了检测jQuery MMenu是否处于打开/活动状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用 jQuery MMenu ,需要使用API​​来检测菜单是否打开

I'm using jQuery MMenu and need to use the API to detect whether or not the menu is open.

我已经查看了他们的事件页面,但是我不知道如何获得它状态.

I've looked over their Events page, but I cannot figure out how to get it's status.

有人请给我一个如何做这个事的例子吗?

Will someone please give me an example of how to do this?

推荐答案

从所述文档中,您可以使用:

From the docs stated, you can use:

1)opening事件,可在菜单打开时触发您的功能.

1) opening event to trigger your function when the menu is opening.

$("#nav").mmenu().trigger("open.mm").on("opening.mm", function() { alert( "The menu is opening" ); });

2)opened事件,当菜单完成打开时触发您的功能

2) opened event to trigger your function when the menu is finished opening

$("#nav").mmenu().trigger("open.mm").on("opened.mm", function() { alert( "The menu has just been opened." ); });

当您的menu处于活动状态时,它将在<nav id="left">中具有类mm-opened,您可以检查:


When your menu is active, it will has class mm-opened in <nav id="left">, you can check:

$('button').click(function() { if($('#left').hasClass('mm-opened')) { $("#nav").trigger("close.mm") } });

更多推荐

检测jQuery MMenu是否处于打开/活动状态?

本文发布于:2023-11-05 04:57:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559964.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:状态   jQuery   MMenu

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!