Omu
Omu

Reputation: 71288

make jQuery UI dialog not change it's position (relative to the browser) when scrolling browser

when I open a jQuyery UI dialog I can scroll the browser and the dialog would change it's position relative to the browser window, I want to make it stay in the same position relative to the browser

Upvotes: 3

Views: 2065

Answers (1)

jAndy
jAndy

Reputation: 236162

The UI dialog has the option dialogClass, where you can specify css classes which get added to the dialog style. So you can define a class like:

.dialogFixed {
    position: fixed !important;
}

and call the Dialog like:

$(function() {
    $( "#dialog" ).dialog({
        dialogClass: 'dialogFixed'
    });
});

A fixed position should fit your requirements here.

Demo: http://jsfiddle.net/MpHN9/

(Well there is no css loaded so the dialog looks ugly, but notice the effect. Even if you scroll the window, the dialog remains in its position)

Upvotes: 4

Related Questions