PDA

View Full Version : scriptaculous Effect Appear to just one div onload...



Hitman
14-04-2009, 04:19 PM
Hey, well I'm using scriptaculous to make one of my divs appear when the page loads. It's making the div load, but it's also making the two divs below it load too... I don't want them to use effect appear, I want them to just load as normal and only have the one div load with the effect... here's my code.

'container-fade' is the ID and class of the div I want to use the effect, the other two divs are just 'container'.


<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
// <![CDATA[
window.onload = function () {
new Effect.Appear('container-fade');
}
// ]]>
</script>

Div that I want to appear with effect

<div class="container-fade" id="container-fade" style="display:none">yo</div>

Divs I want to load normally... (they're the same).


<div class="container" id="container"></div>

I'm new to javascript, any help would be good.

Source
14-04-2009, 06:40 PM
the code you have put up should work... looks to me it might be the way you have structured the layout. Post up the whole HTML markup :)

Hitman
14-04-2009, 07:22 PM
Edit: I've fixed it, thanks. :D I missed off a couple of </divs>

Source
14-04-2009, 09:53 PM
Glad you got it fixed. Just in future, make sure you check the page structure (closed divs etc...) before moving onto integrating other aspects... as it can come back to haunt you.

Want to hide these adverts? Register an account for free!