What are event and UI parameters in jQuery Dialog? Can I get a mouse position using them?
$( ".selector" ).dialog({
open: function(event, ui) { ... }
});
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.
dialog( { ... } ); Then check for the class when needed: if ($("selector"). hasClass("initialized")) { ... }
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);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With