gpt4 book ai didi

javascript - 单击浏览器滚动条关闭弹出窗口

转载 作者:太空宇宙 更新时间:2023-11-03 21:44:32 25 4
gpt4 key购买 nike

单击浏览器滚动条时,我的弹出窗口关闭。我使用此代码关闭弹出窗口:

//Closing the pop up when clicked outside of it.
$(document).click(function(e) {
$("#popup").mouseup(function() {
return false;
});
// Bind mouseup event to all the document
$(document).mouseup(function(e) {
// Check if the click is outside the popup
if($(e.target).parents("#popup").length==0 && !$(e.target).is("#popup") && $(e.target).parents(".calendar").length==0) {
// Hide the popup
alert("hi");
$("#popup").hide();
}
});

});

我的弹出式 CSS 是:

element.style {
display: block;
}
.popupDiv {
background: none repeat scroll 0 0 rgb(245, 245, 245);
border-width: 1px 1px 3px;
padding: 10px 10px 35px;
position: absolute;
right: 0;
top: 85px;
z-index: 999;
}

我需要在单击浏览器的滚动条时不关闭弹出窗口。

最佳答案

希望这对你有帮助。

$(document).ready(function(){
$( window ).scroll(function() {
$("#popup").hide();
});
});

关于javascript - 单击浏览器滚动条关闭弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21302326/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com