Loading ...
Sorry, an error occurred while loading the content.

Problem with photobox

Expand Messages
  • roblj689
    I call a function to show the photobox. I add new ones to it why I have 2 functions. The problem is that the old one stays in the background i.e the modal
    Message 1 of 1 , Oct 1, 2007
    • 0 Attachment
      I call a function to show the photobox. I add new ones to it why I
      have 2 functions. The problem is that the old one stays in the
      background i.e the modal property. So, how do I "destroy" the old one?
      I tried something like:

      function photobox2(bilder){
      YAHOO.example.container.photobox2 = new
      YAHOO.widget.PhotoBox("photobox",
      {
      effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.45},
      fixedcenter:true,
      constraintoviewport:true,
      underlay:"none",
      close:true,
      visible:false,
      draggable:false,
      modal:true,
      photos:[{src:bilder[0],caption:"2"},{src:bilder[1],caption:"Linus
      2"}],
      width:"500px"
      } );
      YAHOO.example.container.photobox2.render();


      YAHOO.util.Event.addListener("show", "click",
      YAHOO.example.container.photobox2.show,
      YAHOO.example.container.photobox2, true);
      }

      function photobox3(bilder){
      YAHOO.example.container.photobox2.destroy(); //Why doesn't
      this work, and what works?

      YAHOO.example.container.photobox3 = new
      YAHOO.widget.PhotoBox("photobox",
      {
      effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.45},
      fixedcenter:true,
      constraintoviewport:true,
      underlay:"none",
      close:true,
      visible:false,
      draggable:false,
      modal:true,
      photos:[{src:bilder[0],caption:"Linus"},
      {src:bilder[1],caption:"Linus 2"},
      {src:bilder[2],caption:"Dobb's Ferry, NY"}
      ],
      width:"500px"
      } );
      YAHOO.example.container.photobox3.render();
      YAHOO.util.Event.removeListener("show", "click",
      YAHOO.example.container.photobox2.show,
      YAHOO.example.container.photobox2, true);
      YAHOO.util.Event.addListener("show", "click",
      YAHOO.example.container.photobox3.show,
      YAHOO.example.container.photobox3, true);
      }
    Your message has been successfully submitted and would be delivered to recipients shortly.