2012-02-29 232 views
0

我一直在围绕模具用这一切的一天,并且不能看着办吧......jQuery的ButtonSet()悬停状态覆盖

我有()利用jQuery UI的buttonset(功能)按钮的列表和即使在我将鼠标悬停在某个按钮之后,我仍想保留ui-active类,但由于某种原因,jQuery UI功能会一直移除该类并从按钮上清除高亮区(这很糟糕,因为用户不知道按钮是什么他们在)。

这是迄今为止代码:

function showSection(sectionIndex){ 
    $('.listSection').hide(); 
    $('#listSection' + sectionIndex).show(); 

    $('.listSectionHeader.ui-state-active').each(function(){ 
     $(this).removeClass('ui-state-active'); 
    }); 

    $('#listSectionHeader' + sectionIndex).addClass('ui-state-active'); 
} 

var buttons = $("#listHeader a"); 

     $.each(buttons, function(){ 
      $(this).bind('mouseleave.button', function(){ 
       if($(this).hasClass('ui-state-active')) 
        return; 
      }); 
     }); 
+0

你也可以发布你的html代码 – DG3 2012-02-29 21:53:22

回答

1

事情是这样的:http://jsfiddle.net/4yamQ/?需要一个额外的类在css如:

ui-state-active, 
ui-mycustomclass 
{ 
jquery ui styling... 
} 
+0

谢谢!您的解决方案帮助我解决了我的问题 – dennismonsewicz 2012-02-29 22:16:24