View Single Post
MagSafe
Senior Member
 
Join Date: Apr 2006
 
2007-10-31, 06:45

Hi again,

I have another query related to JavaScript

Basically I have a div that drops-down when the user clicks a button, it's originally set to "display: none;" so when the user clicks the button its then set to "display: block;", and vice versa.

What i'd like to do is make this similar to drop-down window's in applications, where if the window is shown and the user clicks somewhere else on the screen, the window is then hidden again.

Is there a way of doing this with JavaScript? I'm thinking of using focus() to set the div to "display: none;" again when the user clicks somewhere else on the screen, but i'm not sure on how to go about doing this!

Cheers for any help,

Steve.

Find me on Twitter: @StevenMcLintock
  quote