469,357 Members | 1,550 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,357 developers. It's quick & easy.

YUI Resizable panel

Hi
I am using YUI(Yahoo User Interface) Resizable panel as tool Tip.Now I need to close the panel on body click.Panel should not close if any event is performed in it .I try to close the panel by "<body onclick()>" .I thought trough that i can get the id of the element to close the panel but if i click on the panel i am getting both the id of panel (div id) followed by body id .How can i do this .Right now i am closing the panel with the close option in it.

thanks
Apr 29 '09 #1
3 1769
Ciary
247 Expert 100+
try this:
Expand|Select|Wrap|Line Numbers
  1. function click(id){
  2.    switch (id){
  3.       case idBody: {document.getElementByID('YUI').style.display='none';break}
  4.       case butID: {/*my function*/ break}
  5.       case ...
  6.       ...
  7.    }
  8. }
  9.  
i used something like this and it worked for me.
Apr 29 '09 #2
Hi
Thabk you for your reply.It work but i did some more changes.Your code is like if statement only.The function will be called each time . So i declared a global variable then it works fine.
Expand|Select|Wrap|Line Numbers
  1. var panelCloseValue=0;
  2. function closePanel(idVal){
  3.     switch(idVal){
  4.         case 'bodyId':{
  5.             if(panelCloseValue!=1){
  6.                 panel.hide();
  7.                 panelCloseValue=0;
  8.             }else{
  9.                 panelCloseValue=0;
  10.             }
  11.             break;
  12.         }
  13.         case 'examplecontainer':{
  14.             panelCloseValue=1;
  15.             break;
  16.         }
  17.     }
  18.     }
  19.  
In the above code only after declaring var panelCloseValue=0; it works otherwise it won't work
Apr 29 '09 #3
Dormilich
8,652 Expert Mod 8TB
small improvement...
Expand|Select|Wrap|Line Numbers
  1. var panelCloseValue=0;
  2. function closePanel(idVal){
  3.     switch(idVal){
  4.         case 'bodyId':{
  5.             if(panelCloseValue!=1){
  6.                 panel.hide();
  7.             }
  8.             panelCloseValue=0;
  9.             break;
  10.         }
  11.         case 'examplecontainer':{
  12.             panelCloseValue=1;
  13.             break;
  14.         }
  15.     }
  16. }
Apr 29 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by VR | last post: by
1 post views Thread by pinocchio | last post: by
4 posts views Thread by sam.s.kong | last post: by
3 posts views Thread by Al Henderson | last post: by
2 posts views Thread by ssoffline | last post: by
3 posts views Thread by Anupama | last post: by
3 posts views Thread by Thierry Loiseau | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.