Medyman
04-15-2008, 02:48 PM
1) Script Title: Animated Collapsible Div
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
3) Describe problem:
Hey guys,
Here's the problem. I'm just putting the finishing touches on a site that has a bit of stylesheet switching going on. I'm using the technique described here (http://www.themaninblue.com/writing/perspective/2006/01/19/) (and shown here (http://www.themaninblue.com/experiment/ResolutionLayout/)) to switch the stylesheet based on screen resolution.
In larger resolutions (1000px + viewport), I show a sidebar with an instance of the animated div. In smaller resolutions (<1000px), I get rid of the sidebar and show a "topbar" with an instance of the animated div.
On their own, everything works fine. If on initial pageload the browser is 1000+, the sidebar instance works perfectly. Same with the topbar when the initial pageload happens when the browser is <1000px.
The issue occurs when I resize the browser. According to the resolution-dependent stylesheet script, my stylesheets switch when the conditions are met. There are only 2 stylesheets (one w/ sidebar, one 2/ topbar). The the conditions are met, they switch back and forth. Meaning there is only one instance of the collapsible div visible at a time.
Now, what happens is the instance that was visible at initial pageload is the only one that works. I assume this is because the other element wasn't being displayed (i.e. display:none). I can't use visibility here because it would throw off the alignment.
So, the question (finally, I know) is...
Is there some function I should call within the page resize script that will initiate the animated div script?
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
3) Describe problem:
Hey guys,
Here's the problem. I'm just putting the finishing touches on a site that has a bit of stylesheet switching going on. I'm using the technique described here (http://www.themaninblue.com/writing/perspective/2006/01/19/) (and shown here (http://www.themaninblue.com/experiment/ResolutionLayout/)) to switch the stylesheet based on screen resolution.
In larger resolutions (1000px + viewport), I show a sidebar with an instance of the animated div. In smaller resolutions (<1000px), I get rid of the sidebar and show a "topbar" with an instance of the animated div.
On their own, everything works fine. If on initial pageload the browser is 1000+, the sidebar instance works perfectly. Same with the topbar when the initial pageload happens when the browser is <1000px.
The issue occurs when I resize the browser. According to the resolution-dependent stylesheet script, my stylesheets switch when the conditions are met. There are only 2 stylesheets (one w/ sidebar, one 2/ topbar). The the conditions are met, they switch back and forth. Meaning there is only one instance of the collapsible div visible at a time.
Now, what happens is the instance that was visible at initial pageload is the only one that works. I assume this is because the other element wasn't being displayed (i.e. display:none). I can't use visibility here because it would throw off the alignment.
So, the question (finally, I know) is...
Is there some function I should call within the page resize script that will initiate the animated div script?