Jquery dialog: drag and drop dialog anywhere

Is there a trick to get the jquery dialog to drag at any time? (I mean not only in the title bar)

+4
source share
2 answers

Unlike a sortable element, dialogue elements do not have this functionality (I'm not sure why). If necessary, you can do something like this:

$(document).ready(function() { var // Create dialog dialog = $('div') .dialog({ title: "I'm a dialog" }) .css({cursor: 'move'}), // Get the options manually options = dialog .data("dialog") .uiDialog .data('draggable') .options; // Finally, extend the draggable modal box's // options and remove any restrictions $.extend(options, {cancel: '', handle: ''}); }); 

See a working example here: http://jsfiddle.net/gMP2d/

+2
source
 $("#div_id") .dialog({ position: [3,442], width: 300, height: 90 }) .css({cursor: 'move'}) .parent() .draggable({cancel:'',handle:''}); 
0
source

All Articles