Jump to content

how can i make this script toogly wen click anywere on the page ?


sofian

Recommended Posts

hi every one

i have ascript that wen clik show a div , wen click again (just on the same place were clicked before) the div hide .

i want to make it wen click anywere on the page hide this div .

 

this is the script :

 

<script> 
$(document).ready(function(){
	$("#dropmenu").click(function(e) {
		e.preventDefault();
		if ($("#menupobout").is(":visible")) {
			$("#menupobout").hide();
		}
		else {
			$("#menupobout").show();	
		}
	});
});
</script>

 

the div :

 

<div id="menustyle" >
<ul style="position:absolute" id="menupobout">

 <li id="menustyleavatar">
 <table border="0" >
 <tr>
 <td width="55px" valign="top">

 '.avatar($client,80).'

  </td>
	<td >
	 '.url('u/'.$client['username'],$client['username']).'
	</td>
	</tr>
	</table>

	</li>
	'.url('u/'.$client['username'],t(my page)).'		

	</ul>
	</div>

and this is the css style :

 

#menustyle ul {
 	background-color: #FFFFFF;
	border-bottom: 2px solid #2D4486;
	border-left: 1px solid #333333;
	border-right: 1px solid #333333;
	border-top: 1px solid #333333;
	margin-right: 5px;
	margin-top: -1px;
	min-width: 200px;
	padding-bottom: 5px;
	padding-left: 0;
	padding-right: 12px;
	padding-top: 10px;
	position: absolute;
/*		right: 0; */
/*		top: 100%;*/
	right: 5px;
	z-index: 1;
	display: none;
	text-align: right;
 }
  #menustyle ul a, #menustyle ul  a:visited {
 	color: #4366AD;
	font-weight: normal;
	text-align: right;
 }
  #menustyle li {
 	display: block;
	float: none;
 }
  #menustyleavatar {
 	border-bottom: 1px solid #E0E0E0;
	margin-bottom: 5px;
	margin-top: 5px;
	margin-left: 4px;
	margin-right: 4px;
	min-height: 55px;
	padding-bottom: 0;
	padding-left: 14px;
	padding-right: 0px;
	padding-top: 0;
	position: relative;
 }

 

 

i hop any one help me

thank you

Link to comment
Share on other sites

Please use


[/ic] or [ic]

tags when posting code.  Also, please make a better attempt to explain your problem, starting with using proper English.  I cannot understand what you are asking.

 

first sorry and thank you for this note .

and sorry about my bad english .

 

in fact i have adropdown menu wen click on "menu" the div show , wen click on "menu" again the dive hide .

but i want to make the script hide the div wen click anywere on the page , (for now wen click anywere on the page not hide ).

 

do you understand me now ?

thank you

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.