PDA

View Full Version : Resolved Animated Collapsible DIV v2.2, toggle event error



mitchjburne
06-04-2009, 12:46 PM
1) Script Title: Animated Collapsible DIV v2.2

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse_suppliment.htm

3) Describe problem:

cant seem to get the ontoggle event handler to work on my page, http://www.imajeb.com.au/news.html. I'm trying to set it up so that the little triangle rotates as the div is expaned but all I seem to get is random image errors.

This is the code as taken from my page and were I think the error is located:
[CODE]
<script type="text/javascript">
animatedcollapse.addDiv('b19040901', 'fade=0,speed=400,group=blog,hide=1')
animatedcollapse.ontoggle=function($, divobj, state){
if (divobj.id=="b19040901") document.getElementById(divobj.id+"-toggle").src=(state=="block")? "open.gif" : "close.gif"
}
animatedcollapse.init()
</script>
[CODE]

I'm still new to this so still learning but I have been over it time and time again and am just missing something.

Thanks in advance,
Mitch.

ddadmin
06-04-2009, 05:11 PM
Make sure the paths to the images are correct. I reckon they should be something like:


document.getElementById(divobj.id+"-toggle").src=(state=="block")? "graphics/open.gif" : "graphics/close.gif"

mitchjburne
06-04-2009, 09:11 PM
ah, thanks, I knew it was something stupid I was missing, I just couldnt figure it out...