Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果focusout在操作上,如何停止淡出_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 如果focusout在操作上,如何停止淡出

Javascript 如果focusout在操作上,如何停止淡出,javascript,jquery,html,css,Javascript,Jquery,Html,Css,当我选中其中一个复选框时,我希望该复选框容器不会消失。我怎样才能做到这一点 添加一个站点: $(document).ready(function () { $(".textbox").on({ focus: function () { $(".checkboxcontainer").fadeIn('fast'); }, blur: function () { $(".checkboxconta

当我选中其中一个复选框时,我希望该复选框容器不会消失。我怎样才能做到这一点

添加一个站点:

$(document).ready(function () {
    $(".textbox").on({
        focus: function () {
            $(".checkboxcontainer").fadeIn('fast');
        },
        blur: function () {
            $(".checkboxcontainer").fadeOut('fast');
        }
    });
    $('.checkbox').on('change', function () {
        $(".checkboxcontainer").stop(true, true).show();
    });
});
您还可以使用一个小的超时,检查哪个元素具有焦点,然后清除超时并重置焦点等

$(document).ready(function () {
    var active, timer;
    $(".textbox").on({
        focus: function () {
            $(".checkboxcontainer").fadeIn('fast');
        },
        blur: function () {
            timer = setTimeout(function() {
                $(".checkboxcontainer").fadeOut('fast');
            },300);
        }
    });
    $('.checkbox').on({
        mousedown: function() {
            active = document.activeElement;
        },
        change: function () {
            clearTimeout(timer);
            active.focus();
        }
    });
});

是否可能重复,因此您希望输入淡出?像这样@科尔比:谢谢你,但不是我要找的。阿德内奥有正确的答案,这就是我要找的。非常感谢。
$(document).ready(function () {
    var active, timer;
    $(".textbox").on({
        focus: function () {
            $(".checkboxcontainer").fadeIn('fast');
        },
        blur: function () {
            timer = setTimeout(function() {
                $(".checkboxcontainer").fadeOut('fast');
            },300);
        }
    });
    $('.checkbox').on({
        mousedown: function() {
            active = document.activeElement;
        },
        change: function () {
            clearTimeout(timer);
            active.focus();
        }
    });
});