PDA

View Full Version : Resolved DDAccordion - Accordion Content script - Disable slideDown/slideUp and use show/hide



sc0ttkclark
12-31-2008, 07:17 PM
1) Script Title: Accordion Content script / ddaccordion

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

3) Describe problem: In IE 7 and other browsers, there's a few issues we keep having when the menu slides down. If I click (and don't move my mouse) it then turns the submenu below black, when I move my mouse off the parent it then shows it correctly. So to be fully accurate, it slides perfectly but displays black (and blinks black off and on during the slide).

To solve this, I decided to modify the script so that if someone is using IE, it won't slide and just use the jquery show/hide functions instead. Here are the modifications I made:

Add this above your init (feel free to modify this to suit other browsers too)


<!--[if IE]>
<script type="text/javascript">
var ddanimated;
ddanimated = false;
</script>
<![endif]-->

Then add this to your ddaccordion.js at Line 115


config.animated=(typeof config.animated=="undefined") ? (typeof ddanimated=="undefined")? true : ddanimated : config.animated //check if animated setting is set

Then replace Line 69 on your ddaccordion.js with


if(config.animated==false){$targetContent.hide()}
else{$targetContent.slideUp(config.animatespeed, function(){config.onopenclose($targetHeader.get(0), parseInt($targetHeader.attr('headerindex')), $targetContent.css('display'), isuseractivated)})}

Then replace Line 64 on your ddaccordion.js with


if(config.animated==false){$targetContent.show()}
else{$targetContent.slideDown(config.animatespeed, function(){config.onopenclose($targetHeader.get(0), parseInt($targetHeader.attr('headerindex')), $targetContent.css('display'), useractivated)})}

I hope this helps other people as much as it helped me. I was ready to switch to another script until I thought about this workaround.

Also, this fix gives you the option to add to your init an "animated" parameter, set to false (default is true) if you want to use a show/hide method instead of the animated collapse / open.

bardsworth
05-31-2009, 03:35 PM
They must have changed the ddaccordion.js script since you posted this because adding your additions to the script at the lines you've specified kill the whole piece.

I'm not really a js programmer and haven't really been able to implement this. Could you post a already edited version?

Thanks a million
_d