How do I set the containment on a jQuery UI Dialog?
问题 Is it possible to add containment (confining to the boundary of another element) to jQuery UI's Dialog? 回答1: You could target the dialog box and apply a containment to it. Try this: var container = $('.dialog-container'), dialog = $('.ui-dialog'); // get container top left corner locations var cx1 = container.offset().left, cy1 = container.offset().top; // get dialog size var dw = dialog.outerWidth(), dh = dialog.outerHeight(); // get container bottom right location, then subtract the dialog