Treehouse: Grow your CSS skills. Land your dream job.

Close div when clicking outside of it…

  • # August 24, 2011 at 11:28 am

    Sounds easy I know, but here is the deal.

    I am trying to get it to work with this date picker here:

    Now I have been going back and forth, but nothing I do gets me the desired result. I just want the calendar window that pops up to close if I click outside of it. Help is much appreciated.

    Here is the link to the code:

    # September 9, 2011 at 7:03 am

    … don’t know if there is a way but I’d cheat.

    # September 9, 2011 at 7:08 am

    … and it tries to include the div …. here it is again without greater and less signs …

    (div id=”outside” style=”display:none;”onclick=”myclose()”) (/div)

    # September 9, 2011 at 7:30 am

    … sorry final thing which I’ve forgotten bit of script you need to get the size for the out side object

    function outside_size(){
    if(typeof window.innerWidth!=’undefined’){
    var outside=document.getElementById(‘outside’);’px';

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.