gpt4 book ai didi

jquery - 剑道菜单 :How to listen the open event of menu

转载 作者:行者123 更新时间:2023-11-28 10:23:29 25 4
gpt4 key购买 nike

我们正在使用右键单击 DIV 打开的 contextMenu。我们尝试监听该菜单的打开事件,但它不起作用。还有其他方法吗?

这是代码

<body>      
<div style="width: 100px; height: 30px;background-color:cornsilk" id="menu"></div>
<div id="Ul1" style="height:40px;width:200px" />
<script type="text/javascript">
$("#menu").bind('contextmenu', function (event) {
$("#Ul1").kendoMenu({
orientation: "vertical",
dataSource: [{ text: "Item1" }],
select: function (e) {
alert("Selected");
},
open:function(e){
---------
---------
}
});
});
</script>
</body>

最佳答案

当用户将鼠标悬停在具有子项的菜单项上时,将触发 open 事件。初始化菜单时不会触发它。您可以在创建菜单后调用该代码:

 $("#menu").bind('contextmenu', function (event) {
$("#Ul1").kendoMenu({
orientation: "vertical",
dataSource: [{ text: "Item1" }],
select: function (e) {
alert("Selected");
}
});
// code which will be executed once the menu is created.
});

关于jquery - 剑道菜单 :How to listen the open event of menu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23865590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com