2014-05-09 110 views
0

我正在使用jquery版本1.8.3對話框控件,其中有兩個按鈕。Jquery對話框中的按鈕文本鼠標光標更改

$('<div></div>').appendTo('body').html().dialog({ 
      modal: true, zIndex: 10000, autoOpen: true, 
      width: '450px', resizable: false,stack: false, 
      dialogClass: 'closeDialog', 
      buttons: { 
       "YesButton" : { 
     text: "Yes", 
       id: "yesbtnid",    
       } , 
       "NoButton" : { 
       text: "No", 
       id: "nobtnid",    
       } 
      }, 
      open: function() {    
       $(this).closest('.ui-dialog').find('.ui-button').removeClass("ui-button").addClass("btnHeightWidth"); 
       }); 
       } 
     }); 

我已經加了我的CSS類的按鈕,我的CSS類是

.btnHeightWidth 
{ 
    width:100px; 
    height:43px; 
    font-Weight:bold; 
    font-size:16px; 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEE9E2', endColorstr='#FFC5BFB5'); 
    behavior: url(border-radius.htc); 
    border-radius: 11px; 
    -webkit-border-radius: 11px; 
    cursor:pointer; 
} 

的問題是,當我在按鈕上的文字將鼠標放置,「是」或「否」的鼠標光標的變化從手到指針,如何使它像手一樣穩定。

+0

當我刪除我的CSS類的鼠標光標仍然是手,所以我懷疑問題出在我的自定義CSS類。 – Dwellerincellar

+0

你可以發佈jsfiddle.net嗎? – SW4

+0

http://jsfiddle.net/CC9gM/3/ – Dwellerincellar

回答

0

試試這個CSS:

.ui-dialog .ui-dialog-buttonpane button.ui-state-hover.ui-widget .ui-button-text{ 
     cursor:pointer; 
} 

關鍵是要針對特定​​應用樣式。您可以修改jquery-ui.css中的樣式,也可以創建更多特定的選擇器。您也可以使用!important,但這並不是建議的。

此外,你不需要使用jQuery從按鈕中刪除任何類。 我你的代碼更新爲:

$(this).closest('.ui-dialog').find('.ui-button').addClass("btnHeightWidth"); 

更新代碼:http://jsfiddle.net/lotusgodkk/CC9gM/8/

+0

感謝您的建議,我添加了類到我的CSS,但它並不反映在IE8中的變化,但在其他瀏覽器中工作正常。 – Dwellerincellar

+0

那麼,我只能建議在IE的情況下在CSS規則中添加「!important」。如果你可以分享你的更多html和css,那麼我可以通過看看它來建議其他的東西 –

+0

我嘗試過!很重要,但它的工作。我使用與上面給出的jsfiddle鏈接中給出的相同的代碼。 – Dwellerincellar