Jquery在单击滚动条上显示div

时间:2014-06-16 23:00:23

标签: jquery html css show-hide

如果我点击页面上的任何位置而不是div内部,我试图隐藏div。但如果我点击该滚动条的滚动条,我无法阻止div隐藏。可能是什么问题?

Here is my fiddle

期望:如果我移动滚动条,请不要隐藏div。 (在Internet Explorer中)

    var $container = $(".toolbarContent");

//Hide red div if we click out side of the red div
$(document).mouseup(function (e) {
        if (!$container.is(e.target) // if the target of the click isn't the container...
            && $container.has(e.target).length === 0) // ... nor a descendant of the container
        {
            $container.hide("slow");
        }
    });

$('#showDiv').click(function () {
$container.show();
});

1 个答案:

答案 0 :(得分:1)

我已经在Chrome和Firefox中测试了您的示例,并且没有任何问题,但您使用的是IE 8不支持的jQuery 2.0,可能是问题的原因 here is the browser support details for jQuery 2.0

相关问题