我想用dialogClass
屬性向jQuery對話框添加一個額外的類。這裏的JavaScript:向jquery ui對話框添加一個類的問題
$(function(){
$("#toogleMAmaximized").dialog({
title: 'Missions and Achivments',
autoOpen: false,
height: 500,
width: 700,
modal: true,
dialogClass: 'noPadding',
buttons: {
Cancel: function() {
$(this).dialog("close");
}
},
close: function() {
allFields.val("").removeClass("ui-state-error");
}
})
$("#toogleMAminimized").click(function() {
$("#toogleMAmaximized").dialog("open");
$("#toogleMAmaximized").dialog({dialogClass:'noPadding'});
});
})
<div id="toogleMAminimized" style="" class="noPadding">
<div class="" style="cursor: pointer;position: absolute;right: 0;top: 45px;"><img src ="images/MAminimized.png" alt="missions and achivments"/></div>
</div>
就在你需要它時,我的HTML代碼
<div id="toogleMAmaximized" >
<div id="missions">
<div id="mission1" missiontitle="A new home!" missionpoint="1" missionicon="images/missions/icon/anewhome-icon.png" missionimage="images/missions/anewhome.png" made="f" class="mission notDone"> </div>
</div>
<div id="achivments">
<div id="achivment1" achivmenttitle="Lucha sin cuartel!" achivmentpoint="10" achivmenticon="images/achivments/icon/1.png" achivmentimage="images/achivments/icon/luchasincuartel-plata-ico.png" made="t" class="achivment done"> </div>
</div>
</div>
正如你所看到的,我已經試過要添加的類別在很多方面,我已經嘗試了所有可能的組合但不斷得到相同的結果:否noPadding
類
'dialogClass' [適用於我](http://jsfiddle.net/QHJKm/)。你的代碼[也適用於我](http://jsfiddle.net/QHJKm/1/)。 – Sampson
什麼版本的'jQuery UI'?我正在使用'jQuery UI 1.8.16'。只是看到它使用1.8.18讓我檢查。泰! –
[It works](http://jsfiddle.net/QHJKm/3/)也是1.8.16。 – Sampson