2013-04-30 77 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

相关问题