Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="jquery-1.3.2.js"&gt;&lt;/script&gt; &lt;style&gt; .login-div { width: 100px; height: 100px; margin:auto; border: solid 1px black; position: relative; background-color: #aeaeae; display:none;} .parent-div { width: 300px; height: 300px; margin:auto; border: solid 1px #aeaeae; position: relative;} .footer { margin-bottom: 0px; margin-top:auto; margin-left:auto; margin-right:auto; height:40px; width:200px; position:relative; display:none;} &lt;/style&gt; &lt;script&gt; $(window).load(function(){ var DEBUG = 0; var count = 0; $('.parent-div').bind('click', function(e){ e.preventDefault(); e.stopPropagation(); DEBUG==1?console.log('Target: '+$(e.target).attr('class')):''; DEBUG==1?console.log('Show Hide: '+(count++)):''; //ShowHide(); var target_class = $(e.target).attr('class'); if(target_class == 'link'){ $(".login-div").animate({"height": "toggle"}, { duration: 1000 }); $('.footer').toggle(); } else{ $(".login-div").animate({"height": "hide"}, { duration: 1000 }); $('.footer').hide(); } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="parent-div"&gt;Parent Box:&lt;br/&gt; &lt;a href="#" class="link"&gt;ShowHide&lt;/a&gt; &lt;div class="login-div"&gt;Child Box:&lt;/div&gt; &lt;div class="footer"&gt;click out side the gray box &amp; inside the Parent-box &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><br/></p> <p>I rigged up the above based on my understanding of your requirement, check out the code. this should do your job. Here I am using "click" event bubbling in java script and have a event listener bound to <code>parent-div</code> class element. this same can be attached to <code>&lt;body/&gt;</code> if the scope of elements is to be increased.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload