I have a page with a div, <div id= PF_Text_Panel></>, containing text that describes an image, the image is in a separate div. Using CSS the text panel is on top of the image and covers about 1/3 of the image’s left side. A slide effect, handled by the function Slide (see code below), targets the PF_Text_Panel div. The function Slide is triggered by an onClick event allowing the user to slide the description to the left and reveal the entire image.
The function Slide contains an if statement. The if statement is used to determine if PF_Text_Panel is open or closed using the variable SldPnlState as a flag. If the variable SldPnlState ==1, then run Slide. The other part of this function, which actually slides the div is an instance of the Slide Effect, inserted using Dreamweaver CS4.
The variable SldPnlState is set using the function setSldPnlState
The function setSldPnlState, initiated by an onClick, passes a value to the variable SldPnlState, in this case it can be set to either 0 or 1 by separate onClick events. It seems like the function Slide always refers to the default value of the variable and not value I am trying to pass. If set to 1 sliding occurs and if I set it to zero no sliding, but at least I know the slide function is working. So…
…to test if the variable SldPnlState is being passed from the onClick event to the variable I included the function printVar which writes the value of the variable SldPnlState to the screen which seems to work fine, You can demo the page at: http://dg-ad.com/Slide_Effect_Logic_Parameter.html
Could there be a problem with how I am declaring the variable SldPnlState or thr function setSldPnlState, perhaps there is some conflict between local and global variable. Is my if statement in the right place
Attached is the code, if anyone has some suggestions I would sure appreciate hearing from you: