Mouseleave 停止按钮在jQuery UI buttonset中丢失活动状态

Mouseleave 停止按钮在jQuery UI buttonset中丢失活动状态,mouseleave,lost-focus,jquery-ui-button,jqueryi-ui-buttonset,Mouseleave,Lost Focus,Jquery Ui Button,Jqueryi Ui Buttonset,我试图防止我的按钮丢失mouseleave上的活动类,但我无法让它工作 因此,我的按钮是用jQuery的buttonset()初始化的。它们是按钮,而不是复选框。复选框是不可能的,因为它们需要ID才能工作 这是我的代码: $('.jquery_ui_buttonset', this.scope).buttonset(); $('.jquery_ui_buttonset > button', this.scope).each(function() { $(this).bind('m

我试图防止我的按钮丢失mouseleave上的活动类,但我无法让它工作

因此,我的按钮是用jQuery的
buttonset()
初始化的。它们是按钮,而不是复选框。复选框是不可能的,因为它们需要ID才能工作

这是我的代码:

$('.jquery_ui_buttonset', this.scope).buttonset();

$('.jquery_ui_buttonset > button', this.scope).each(function() {
    $(this).bind('mouseleave keyup mouseup blur', function(e) {
        if ($(this).hasClass('ui-state-persist')) {
            e.stopImmediatePropagation();
            if (e.type == 'blur') {
                $(this).removeClass('ui-state-focus');
            }
            $(this).removeClass('ui-state-hover');
        }
    });
});
其思想是,如果按钮具有
ui状态persist
类,则在明确删除这两个类之前,它不应丢失
ui状态active
类。此处理程序在单击时切换活动按钮:

CMSPage.prototype.switchEditTab = function(e) {
    if (e.data.params.id == null) {
        return;
    }

    $('.editor .body', this.scope).hide();
    $('.editor .header button', this.scope).removeClass('ui-state-active').removeClass('ui-state-persist');
    $('.editor .body[data-tab-id=' + e.data.params.id + ']', this.scope).show();
    $('.editor .header button[data-id=' + e.data.params.id + ']', this.scope)
        .addClass('ui-state-active').addClass('ui-state-persist');
}
我还尝试添加了
e.stopPropagation()
e.preventDefault()
及其所有组合,但都不起作用。同样的代码也适用于常规UI按钮(buttonset中没有的)

任何帮助都将不胜感激

编辑

我还没有解决这个问题。我很乐意为你们提供帮助,但我不能,因为我是新会员。没有人遇到过这样一个问题,他想用持续活动的按钮而不是复选框来使用
buttonset()