jQuery ui Dialog: Turn off 'Draggable' for Dialog content

Evan Layman picture Evan Layman · Jul 18, 2011 · Viewed 36.5k times · Source

I'm having a brain fart and cannot seem to get the content of my jquery ui dialog to stop being 'draggable'. I turned off the draggable setting on the actual dialog pop-up, however, the content inside the box is still able to be dragged out of the box's view. I'd like to have a static positioned box and static positioned content within the box.

Here is my code:

$('.LinkBtn').click(function (e) {
        e.preventDefault();
        var OfferID = $(this).attr('id').substring(8);
        $('#HiddenLinks_' + OfferID).show();
        newDialog(OfferID);
    });
    function newDialog(OfferID) {
        var divObj = $('#HiddenLinks_' + OfferID);
        var $dialog = divObj
        .draggable()
        .dialog({
            draggable: false,
            autoOpen: false,
            resizable: false,
            modal: false,
            title: $('#HiddenLinks_' + OfferID).attr('title')
        }).draggable(false);
        $dialog.dialog('open');
        return false
    }

Thanks!

Answer

Sorin Haidau picture Sorin Haidau · Dec 16, 2015
    $('#popup').dialog({
        width: 600,
        modal: true,
        resizable: false,
        draggable: false
    });

In this example I disabled both draggable and resizable events on a dialog box.