2012-02-29 216 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