jQuery ButtonSet()悬停状态覆盖

时间:2012-02-29 21:24:35

标签: jquery-ui

我整天都在用这个工具来解决这个问题......

我有一个按钮列表(利用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;
            });
        });

1 个答案:

答案 0 :(得分:1)

像这样:http://jsfiddle.net/4yamQ/?需要在css中增加一个类,例如:

ui-state-active,
ui-mycustomclass
{
jquery ui styling...
}
相关问题