Dialog中的事件和UI参数是什么? [英] What are event and UI parameters in Dialog

查看:172
本文介绍了Dialog中的事件和UI参数是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery对话框中的事件和UI参数是什么?我可以使用它的鼠标位置吗?

  $(.selector).dialog({
open: function(event,ui){...}
});


解决方案

事件参数是 DOM事件对象 ui 参数通常是一个哈希;其属性取决于引发的事件。

对于对话框打开事件,这两个参数看起来都为空。对于其他事件,例如 dragStart drag dragStop ui 将包含当前的位置和偏移量:

  $('对话框({
drag:function(event,ui)){
console.log(当前位置:+ ui.position);
}
} );


What are event and UI parameters in jQuery Dialog? Can I get a mouse position using them?

$( ".selector" ).dialog({
   open: function(event, ui) { ... }
});

解决方案

The event parameter is the DOM Event object. The ui parameter is typically a hash; its properties depend on the event being raised.
For the dialog open event, both arguments appear to be null. For other events, such as dragStart, drag and dragStop, ui will contain the current position and offset:

$('.selector').dialog({
    drag: function(event, ui) {
        console.log("Current position: " + ui.position);
    }
});

这篇关于Dialog中的事件和UI参数是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆