Glowing Chrystal

An sNews version 1.5 template

Slide open and close divs

For people that is not using sNews and want to be able to have a toggle function on their websites this might come in handy.

Now a disclaimer:

This snippet is not mine, it has been on my harddrive for sometime, and I can honestly not remember where I got it from, so if anybody knows please let me know so I can give credit where credit is due...

Now, showing a div by clicking a link. then hiding it by clicking another link is fairly simple. You need a javascript snippet in order to do this. Click the "Show JS code" and copy and paste this snippet into a document which you upload to your server named motionpack.js

Show JS code   |   Close JS code

What you do after this is placing a link to the JS file in your header, like this:

I have my script put in the folder scripts/ that's why it looks this way. Now when the "engine" is up, you need to add the code to your document in order to make it work. So just to try it out, open up the document and add something like:

Slide down    |    Slide up

Now you should have a working toggled H3 title there, right ? Well, if the existance of two links making it possible to show/hide is to much, we simply add another function to the motionpack.js in order to be able to have but one occurance of a link. (Go check the function on the bottom of the JS file. Which already been added.)

And instead of the previous code in the document we add this:

Show/hide - div

19.09.2007. 12:14

This article hasn't been commented yet.

Write a comment

:

:

: