Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are event and UI parameters in Dialog

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

$( ".selector" ).dialog({
   open: function(event, ui) { ... }
});
like image 864
Mayur Avatar asked Aug 23 '10 12:08

Mayur


People also ask

What is dialog in jquery?

A dialog box is a floating window with a title and content area. This window can be moved, resized, and of course, closed using "X" icon by default. jQueryUI provides dialog() method that transforms the HTML code written on the page into HTML code to display a dialog box.

How do you check if jquery dialog is initialized?

dialog( { ... } ); Then check for the class when needed: if ($("selector"). hasClass("initialized")) { ... }


1 Answers

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);
    }
});
like image 71
elo80ka Avatar answered Oct 07 '22 04:10

elo80ka