【发布时间】:2013-10-03 12:34:03
【问题描述】:
如何防止 jQuery UI 菜单在单击项目时聚焦在菜单上。
我有一个选择菜单,当单击一个项目时,它会立即应用一个操作,然后菜单关闭。
因为 jQuery UI 在点击时触发了焦点事件(http://code.jquery.com/ui/1.9.2/jquery-ui.js 的第 10956 行),它在 Chrome 中失去了选择(Firefox 似乎可以工作)。
...
} else if ( !this.element.is( ":focus" ) ) {
// Redirect focus to the menu
this.element.trigger( "focus", [ true ] ); // <----- this line
...
}
...
【问题讨论】:
-
您的 html 和代码仍然会有所帮助,您的菜单代码以及您的其他代码
-
我没试过,但是 $( ".selector" ).menu({ focus: function() { return false; } });
-
无论如何,你可以为这个问题制作一个 jsFiddle,这会有所帮助。 jsfiddle.net
标签: javascript jquery jquery-ui selection