2014-05-09 108 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