views:

24

answers:

1

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

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

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);
    }
});
elo80ka