Jquery 引导折叠鼠标打开输入鼠标左键关闭

Jquery 引导折叠鼠标打开输入鼠标左键关闭,jquery,twitter-bootstrap,Jquery,Twitter Bootstrap,我的目标是使用bootstrap来创建一组折叠按钮,当光标处于打开状态时,这些按钮会扩展,当光标离开时,这些按钮会折叠。它只能是一次开放式崩溃。我的代码使用的是一个按钮,但当我用光标快速切换按钮时,前两个(按钮1和按钮2)仍然打开,最后一个(按钮3)工作正常(它打开然后关闭)。我用它来实现我的代码。有人能帮我修一下吗?这里是一个链接。以下是我的JQuery代码: $('.row .collapse-container').on('mouseenter', function(e){ $te

我的目标是使用bootstrap来创建一组折叠按钮,当光标处于打开状态时,这些按钮会扩展,当光标离开时,这些按钮会折叠。它只能是一次开放式崩溃。我的代码使用的是一个按钮,但当我用光标快速切换按钮时,前两个(按钮1和按钮2)仍然打开,最后一个(按钮3)工作正常(它打开然后关闭)。我用它来实现我的代码。有人能帮我修一下吗?这里是一个链接。以下是我的JQuery代码:

$('.row .collapse-container').on('mouseenter', function(e){
    $textHolder = $('.text-container', this)[0];

    $($textHolder).queue(function(){
        $($textHolder).collapse('show');
        if (!$($textHolder).hasClass('collapsing')){
            $(this).dequeue();      
        }
    })
    if (!$($textHolder).hasClass('collapsing')){
        $($textHolder).dequeue();
    }
})
$('.row .collapse-container').on('mouseleave', function(e){
    $textHolder = $('.text-container', this)[0];
    $($textHolder).queue(function(){
    $($textHolder).collapse('hide');
        if (!$($textHolder).hasClass('collapsing')){
            $(this).dequeue();      
        }
    })
    if (!$($textHolder).hasClass('collapsing')){
        $($textHolder).dequeue();
    }
})
$('.row').on('shown.bs.collapse hidden.bs.collapse', '.text-container', function(e) {
    $(this).dequeue();
});
$('.row .collapse-container').on('mouseenter', function (e) {
    $textHolder = $('.text-container', this)[0];

    $($textHolder).queue(function () {
        $($textHolder).collapse('show');
    })
    if (!$($textHolder).hasClass('collapsing')) {
        $($textHolder).dequeue();
    }
})
$('.row .collapse-container').on('mouseleave', function (e) {
    $textHolder = $('.text-container', this)[0];
    if ($($textHolder).hasClass('collapsing')) {
        $($textHolder).queue(function () {
            $(this).collapse('hide');
            $(this).dequeue();
        });
    }else{
        $($textHolder).collapse('hide');
    }
})
$('.row').on('shown.bs.collapse hidden.bs.collapse', '.text-container', function (e) {
    $(this).dequeue();
});

在我让它休眠之后,我得到了一个解决方案,在我的测试中99%都有效。唯一不起作用的情况是在运行“折叠动画”时输入元素。但这是我目前能做的最好的了。这是我的解决方案,如果其他人有足够好的东西来使用它。或者,如果你能让它在100%的工作将是伟大的。以下是到的链接和jQuery代码:

$('.row .collapse-container').on('mouseenter', function(e){
    $textHolder = $('.text-container', this)[0];

    $($textHolder).queue(function(){
        $($textHolder).collapse('show');
        if (!$($textHolder).hasClass('collapsing')){
            $(this).dequeue();      
        }
    })
    if (!$($textHolder).hasClass('collapsing')){
        $($textHolder).dequeue();
    }
})
$('.row .collapse-container').on('mouseleave', function(e){
    $textHolder = $('.text-container', this)[0];
    $($textHolder).queue(function(){
    $($textHolder).collapse('hide');
        if (!$($textHolder).hasClass('collapsing')){
            $(this).dequeue();      
        }
    })
    if (!$($textHolder).hasClass('collapsing')){
        $($textHolder).dequeue();
    }
})
$('.row').on('shown.bs.collapse hidden.bs.collapse', '.text-container', function(e) {
    $(this).dequeue();
});
$('.row .collapse-container').on('mouseenter', function (e) {
    $textHolder = $('.text-container', this)[0];

    $($textHolder).queue(function () {
        $($textHolder).collapse('show');
    })
    if (!$($textHolder).hasClass('collapsing')) {
        $($textHolder).dequeue();
    }
})
$('.row .collapse-container').on('mouseleave', function (e) {
    $textHolder = $('.text-container', this)[0];
    if ($($textHolder).hasClass('collapsing')) {
        $($textHolder).queue(function () {
            $(this).collapse('hide');
            $(this).dequeue();
        });
    }else{
        $($textHolder).collapse('hide');
    }
})
$('.row').on('shown.bs.collapse hidden.bs.collapse', '.text-container', function (e) {
    $(this).dequeue();
});

在我让它休眠之后,我得到了一个解决方案,在我的测试中99%都有效。唯一不起作用的情况是在运行“折叠动画”时输入元素。但这是我目前能做的最好的了。这是我的解决方案,如果其他人有足够好的东西来使用它。或者,如果你能让它在100%的工作将是伟大的。以下是到的链接和jQuery代码:

$('.row .collapse-container').on('mouseenter', function(e){
    $textHolder = $('.text-container', this)[0];

    $($textHolder).queue(function(){
        $($textHolder).collapse('show');
        if (!$($textHolder).hasClass('collapsing')){
            $(this).dequeue();      
        }
    })
    if (!$($textHolder).hasClass('collapsing')){
        $($textHolder).dequeue();
    }
})
$('.row .collapse-container').on('mouseleave', function(e){
    $textHolder = $('.text-container', this)[0];
    $($textHolder).queue(function(){
    $($textHolder).collapse('hide');
        if (!$($textHolder).hasClass('collapsing')){
            $(this).dequeue();      
        }
    })
    if (!$($textHolder).hasClass('collapsing')){
        $($textHolder).dequeue();
    }
})
$('.row').on('shown.bs.collapse hidden.bs.collapse', '.text-container', function(e) {
    $(this).dequeue();
});
$('.row .collapse-container').on('mouseenter', function (e) {
    $textHolder = $('.text-container', this)[0];

    $($textHolder).queue(function () {
        $($textHolder).collapse('show');
    })
    if (!$($textHolder).hasClass('collapsing')) {
        $($textHolder).dequeue();
    }
})
$('.row .collapse-container').on('mouseleave', function (e) {
    $textHolder = $('.text-container', this)[0];
    if ($($textHolder).hasClass('collapsing')) {
        $($textHolder).queue(function () {
            $(this).collapse('hide');
            $(this).dequeue();
        });
    }else{
        $($textHolder).collapse('hide');
    }
})
$('.row').on('shown.bs.collapse hidden.bs.collapse', '.text-container', function (e) {
    $(this).dequeue();
});