Log in

View Full Version : Animated Collapsible DIV v2.01



PeterG
01-15-2009, 01:40 PM
Question:

In the example on your site, http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm, pressing the button toggles the state.
Instead of the button, I would like to see a '+' to expand, and a '-' to close. This means the the gif also needs to be toggled. Can you suggest a way to do this?

Thanks,

Peter

jscheuer1
01-15-2009, 03:11 PM
You don't really need any images, you could use a button:


<input type="button"
onclick="animatedcollapse.toggle('jason'); this.value = this.value == '+'? '-' : '+';"
value="+">

If you want to use images:


<a href="#" onclick="animatedcollapse.toggle('jason');return false;"
><img src="plus.gif"
onclick="this.src = /plus\.gif$/.test(this.src)? 'minus.gif' : 'plus.gif';"
alt=""></a>