Forum Moderators: open

Message Too Old, No Replies

JS Slide Animation

         

sweetmoses

4:23 pm on Apr 29, 2011 (gmt 0)

10+ Year Member



The page I'm working on has links that animate open divs onclick. Here's the script:

function showSlidingDiv1(){
$("#slide1").animate({"height": "toggle"}, { duration: 1000 });}


And it works fine. The problem I have is that I have 3 other divs (#slide2, #slide3, #slide4) that need to display:none when the function is run.

I tried adding

document.getElementById('slide2').style.display = 'none';
document.getElementById('slide3').style.display = 'none';
document.getElementById('slide4').style.display = 'none';


to the function, but to no avail. I feel like this should be easy. Anybody got any ideas?

Fotiman

4:49 pm on Apr 29, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




function showSlidingDiv1(){
$("#slide2, #slide3, #slide4").hide();
$("#slide1").animate({"height": "toggle"}, { duration: 1000 });
}

sweetmoses

5:05 pm on Apr 29, 2011 (gmt 0)

10+ Year Member



Sweet! Look what you did: [johnthomasse.com ]

The simplest solution is always the most elegant.

rocknbil

5:26 pm on Apr 29, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Error: MM_preloadImages is not defined

Take that out of your <body>

sweetmoses

5:42 pm on Apr 29, 2011 (gmt 0)

10+ Year Member



yes sir