2012-06-02 4 views
3

Как возможно, чтобы диалоговое окно jquery UI соответствовало прокрутке окна?Последовательный диалог диалога jquery UI?

+8

«позиция: исправлена» – undefined

+0

это работает только с диалоговым содержимым, а не со всем диалогом – RoseWarad

+0

попробуйте следующее: 'ui-dialog {position: fixed! I mportant} ' – undefined

ответ

3

Это возможно, но вы должны переопределить стили базы jQueryUI, поэтому убедитесь, что (в вашем CSS) у вас есть:

.ui-dialog { 
    position: fixed !important; 
} 

Вот пример:

$(function() { 
 
    $("#dialog-modal").dialog({ 
 
    height: 140, 
 
    modal: true 
 
    }); 
 
});
body { 
 
    height: 3000px; 
 
    } 
 

 
p { 
 
    margin-bottom: 300px; 
 
    } 
 

 
.ui-dialog { 
 
    position: fixed !important; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 
 
<link href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" rel="stylesheet" /> 
 
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> 
 

 

 
<div id="dialog-modal" title="Basic modal dialog"> 
 
    <p>Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.</p> 
 
</div> 
 

 

 
<!--these are here to help show that the dialogue is actually fixed --> 
 
<p>A</p> 
 
<p>B</p> 
 
<p>C</p> 
 
<p>D</p> 
 
<p>E</p> 
 
<p>F</p>

Смежные вопросы