2013-04-30 102 views
0

我試圖定位jQuery對話框上的按鈕,但僅限於頁面上的幾個對話框中的一個對話框。樣式對話框按鈕只有一個jQuery對話框的幾個頁面

我通常會使用之前目標的按鈕:

的.ui-對話框的.ui-對話框的buttonpane

的.ui-對話框的.ui-對話框的buttonpane的.ui-對話-buttonset

在這種情況下,我只想爲這一個對話框設置按鈕樣式(我想將它們居中)。

<div id="one" style="display:none;"> 
    Content of the dialog 
</div> 

<script type="text/javascript"> 
$(document).ready(function(){ 
    $("#one").dialog({ 
    buttons: {"save":function(){alert("saved");}} 
    }); 
}); 
</script> 

我怎樣可以針對剛剛與CSS這一個對話框:

對話是從一個隱藏的DIV產生的?

謝謝!

回答

1

只使用CSS,你應該能夠使用兄弟選擇,因爲jQuery UI採用了#one元素插入對話框的身體:

#one ~ .ui-dialog-buttonpane .ui-dialog-buttonset { 
    margin: auto; 
    /* whatever other styling you need here */ 
} 
+0

謝謝!我可以如下使用它:#one〜.ui-dialog-buttonpane {text | align:center; } #one〜.ui-dialog-buttonpane .ui-dialog-buttonset { float:none; } – salonMonsters 2013-04-30 15:58:53

相關問題