开发者

Trigger Javascript Function when user clicks anywhere on page

I have a ModalPopupExtender that needs to be hidden whenever the user clicks anywhere else on the page, window, or scrollbar. I have a function and it works if i set it to a div tag but what about when the user clicks the windows scrollbar?

function HideList() {
    $find("<%=ModalPopupExtender1.BehaviorID%>").hide();
}

<div id=开发者_如何学Python"maindiv" onclick="HideList()">
    Elements...
</div>


AFAIK, it's not possible to target the scroll bar using JavaScript.

However, you can target the scroll event and any click event on the window:

$(window).bind('scroll click', function() {
    alert('Boo');
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜