sofian Posted July 10, 2011 Share Posted July 10, 2011 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 https://forums.phpfreaks.com/topic/241579-how-can-i-make-this-script-toogly-wen-click-anywere-on-the-page/ Share on other sites More sharing options...
.josh Posted July 10, 2011 Share Posted July 10, 2011 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. Link to comment https://forums.phpfreaks.com/topic/241579-how-can-i-make-this-script-toogly-wen-click-anywere-on-the-page/#findComment-1240988 Share on other sites More sharing options...
sofian Posted July 12, 2011 Author Share Posted July 12, 2011 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 https://forums.phpfreaks.com/topic/241579-how-can-i-make-this-script-toogly-wen-click-anywere-on-the-page/#findComment-1241922 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.