Drupal 5 and later versions provide an animation when you expand or collapse a collapsible form fieldset.
While this is a nifty effect, it can be annoying to some users, and it can slow you down when viewing a web page over a Remote Desktop session in Windows (I use Remote Desktop a lot at home, and the expand/collapse animation can take seconds to complete depending on network speed–it all adds up).
While trying to find a solution, I came across this thread on drupal.org offering a simple solution: Just add the following snippet of JavaScript to each page:
Drupal.toggleFieldset = function(fieldset) {
fieldset.animating = false;
if ($(fieldset).is('.collapsed')) {
$(fieldset).removeClass('collapsed');
}
else {
$(fieldset).addClass('collapsed');
}
};
And presto -- the animation is gone, the fieldsets expand/collapse instantly.
But, how to insert the JavaScript? You can hack your theme's files to manually inject the JavaScript snippet of you are so inclined. Simple, efficient, and to the point. Of course, if you have numerous page templates, you might need to modify many or all.
But if you are like me, and prefer not to hack your theme files, or if you switch between themes on occasion and prefer not to add to your maintenance headaches, you might want to seek another alternative.
My approach: Create a small custom Drupal module to disable fieldset animations. The Drupal module injects the new JavaScript into the page footer. This allows you to drop in and enable the module in order to disable the animation effect.
Yes, there's a small performance hit for the additional module load and injection of the extra JavaScript file. If that performance hit is unacceptable, you can always hand-patch your theme files for maximum performance.
You can download a pre-built module for Drupal 5 (see attachments.)
Attachment | Size |
---|---|
fieldset_animation_disable-0.2-dev.tar.gz | 1.02 KB |