YUI Resizable panel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shareme
    New Member
    • Dec 2008
    • 8

    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
  • Ciary
    Recognized Expert New Member
    • Apr 2009
    • 247

    #2
    try this:
    Code:
    function click(id){
       switch (id){
          case idBody: {document.getElementByID('YUI').style.display='none';break}
          case butID: {/*my function*/ break}
          case ...
          ...
       }
    }
    i used something like this and it worked for me.

    Comment

    • shareme
      New Member
      • Dec 2008
      • 8

      #3
      YUI Resizable panel

      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.
      Code:
      var panelCloseValue=0;
      function closePanel(idVal){
          switch(idVal){
          	case 'bodyId':{
          		if(panelCloseValue!=1){
          			panel.hide();
          			panelCloseValue=0;
          		}else{
          			panelCloseValue=0;
          		}
      	    	break;
      	    }
          	case 'examplecontainer':{
          		panelCloseValue=1;
      	    	break;
      	    }
          }
          }
      In the above code only after declaring var panelCloseValue =0; it works otherwise it won't work

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        small improvement...
        Code:
        var panelCloseValue=0;
        function closePanel(idVal){
            switch(idVal){
            	case 'bodyId':{
        [B]    		if(panelCloseValue!=1){
            			panel.hide();
            		}
            		panelCloseValue=0;
        [/B]	    	break;
        	    }
            	case 'examplecontainer':{
            		panelCloseValue=1;
        	    	break;
        	    }
            }
        }

        Comment

        Working...