Monday, June 27, 2011

how to hide a div when cliked outside its region

jQuery(document).ready(function()
{
    jQuery('#loginDiv').hover(function(){  
        mouse_inside_div=true;
    }, function(){
        mouse_inside_div=false;
    });

    jQuery('body').mouseup(function(){
        if(! mouse_inside_div) jQuery('#loginDiv').hide();
    });
});

<div id="loginDiv"></div>

http://www.mohitsharma.net/category/category/jquery?page=1 this  the link where i got this code.


No comments:

Post a Comment