开发者

jQuery Hide Toggeled Div On Document.click

开发者 https://www.devze.com 2023-02-27 04:51 出处:网络
I currently have the following code: $(function(){ $(\'#btn_signIn\').click(function(){ $(\'#div_signInBox\').toggle(\"fast\");

I currently have the following code:

$(function(){
  $('#btn_signIn').click(function(){
    $('#div_signInBox').toggle("fast");
  });
});

I need to hide the div_signInBox toggled div anytime any other part of the wi开发者_Go百科ndow is clicked...

Thanks!


Is this what you want?

$(function() {
    $('#div_signInBox,html').click(function() {
        if ($(this).is('#div_signInBox')) 
            return false;

        $('#div_signInBox').toggle("fast");
    });
});
0

精彩评论

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

关注公众号