colindo
03-09-2012, 09:34 AM
1) Script Title: Animated Collapsible DIV v2.4
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
3) Describe problem:
Im very new to javascript so im a little lost on how to modify the event handler in the Animated Collapse script. I have it all set up and working fine. I figured out how to keep the text on the toggle button to remain a color (red in this case) while the div is expanded. and when i click the toggle button again to collapse the div it returns to the original color (white in the case). This is exactly what I want.
The problem is...by modifying the javascript in the event handler to allow the expanded div to remain a different color then all the other collapsed divs, It seems to override the a:hover I have set up in CSS. I want the text on the buttons to change to red when hovered, but it doesn't work once I modify the javascript in the event handler.
Here is the current event handler code:
animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
if ($('#'+divobj.id+"-toggle").length==1) //if toggler link exists
$('#'+divobj.id+"-toggle").css('color', (state=='block')? 'red' : 'white')
}
Thanks in advanced
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
3) Describe problem:
Im very new to javascript so im a little lost on how to modify the event handler in the Animated Collapse script. I have it all set up and working fine. I figured out how to keep the text on the toggle button to remain a color (red in this case) while the div is expanded. and when i click the toggle button again to collapse the div it returns to the original color (white in the case). This is exactly what I want.
The problem is...by modifying the javascript in the event handler to allow the expanded div to remain a different color then all the other collapsed divs, It seems to override the a:hover I have set up in CSS. I want the text on the buttons to change to red when hovered, but it doesn't work once I modify the javascript in the event handler.
Here is the current event handler code:
animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted
if ($('#'+divobj.id+"-toggle").length==1) //if toggler link exists
$('#'+divobj.id+"-toggle").css('color', (state=='block')? 'red' : 'white')
}
Thanks in advanced