jQuery 对话框中的事件和 UI 参数是什么?我可以使用它们获取鼠标位置吗?
$( ".selector" ).dialog({
open: function(event, ui) { ... }
});
The event
参数是DOM 事件对象 http://www.w3schools.com/jsref/dom_obj_event.asp. The ui
参数通常是一个哈希值;它的属性取决于引发的事件。
对于对话框open
事件时,两个参数似乎都为空。对于其他事件,例如dragStart
, drag
and dragStop
, ui
将包含当前位置和偏移量:
$('.selector').dialog({
drag: function(event, ui) {
console.log("Current position: " + ui.position);
}
});
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)