PDA

View Full Version : [DHTML] Collapsable Div with limit and groups



Master_script_maker
12-26-2007, 08:22 PM
1) CODE TITLE: Collapsable Div with limit and groups

2) AUTHOR NAME/NOTES: Master script maker (based on my other div script)

1. First download div.js and add this to the head of your code:
<script type="text/javascript" src="div.js"></script>

2. For Groups:
a. Add this in your body:

<script type="text/javascript">
var limit1 = new limit(# of divs allowed open at a time in group 1);
var limit2 = new limit(# of divs allowed open at a time in group 2);
<script>
and change the "limit1" and "limit2" to whatever you want to call them. You can have more then just the 2.
b. If you want to open a div in group 1 use:

<a href="#" onClick="limit1.change(div id)"></a>
for group two, ect. just change the first part of the onclick. (limit1)
You MUST have the ".change()" after the name of the limit.

3. For just the whole document:
a.
<script type="text/javascript">
var limit = new limit(# of divs allowed open at a time);
</script>
b. If you want to open a div use:

<a href="#" onClick="limit.change(div id)"></a>
You can change the "limit" to whatever you want.
You MUST have the ".change()" after the name of the limit.

4) DESCRIPTION: A simple script that manages multiple groups of divs with independant limits(or just whole page). When a user tries to open more divs then the limit, the first div opened, is closed.

4) URL TO CODE:
Demo:http://masterproject.freehostia.com/div/divs.html
Script:http://masterproject.freehostia.com/div/div.js

or, ATTACHED BELOW (see #3 in guidelines below):

djr33
12-26-2007, 11:40 PM
Again, good. You should simply merge the other one and this into one submission, with optional groups.