I am using a slideToggle technique to show and hide 100+ DIVs full of information in my application. I have "Show All" and "Hide All" buttons and I'd like for them to have the slideToggle animation as well (instead of just showing and hiding all). However on IE6, the slideToggle runs really slow when being applied to each element.
Does anyone know how to speed this up? Also, I'm switching icons that are in the msg_head, but that isn't slowing it down. If I remove th slideToggle and replace it with just a show/hide (on the show all/hide all) it performs fine. However I'd like to have the animation if possible.
<p class="msg_head" onclick="toggleSelection($(this));">Heading</p>
<div class="msg_body">
content
</div>
And my show all and hide all functions...
function toggleSelection(element) {
element.next("msg_body").slideToggle(250);
element.find(":first-child").toggleClass("ui-icon-circle-arrow-s");
element.find(":first-child").toggleClass("ui-icon-circle-arrow-e");
}
function showall() {
$(".msg_head").each(function() {
$(this).next(".msg_body:hidden").slideToggle(250);
$(this).find(":first-child").attr('class','ui-icon ui-icon-circle-arrow-s');
});
}
function hideall() {
$(".msg_head").each(function() {
$(this).next(".msg_body:visible").slideToggle(250);
$(this).find(":first-child").attr('class','ui-icon ui-icon-circle-arrow-e');
});
}
For the record, the individual toggleSection() function performs flawlessly. And replacing the slideToggle in the showall and hideall functions with show and hide works well too. I'm really just seeing if there's a way to get the slideToggle animation without it looking choked up.