Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you fix the flickering that occurs when you use slideToggle in jQuery?

I have a simple unordered list that I want to show and hide on click using the jQuery slideUp and slideDown effect. Everything seems to work fine, however in IE6 the list will slide up, flicker for a split second, and then disappear.

Does anyone know of a fix for this?

Thanks!

like image 935
go minimal Avatar asked Sep 21 '08 16:09

go minimal


2 Answers

Apologies for the extra comment (I can't upvote or comment on Pavel's answer), but adding a DOCTYPE fixed this issue for me, and the slideUp/Down/Toggle effects now work correctly in IE7.

See A List Apart for more information on DOCTYPES, or you can try specifying the fairly lenient 4/Transitional:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
like image 170
Mike Gardiner Avatar answered Nov 15 '22 14:11

Mike Gardiner


Just let IE6 flicker. I don't think it's worth it to invest time in a dying browser when your base functionality works well enough. If you're worried about flickering for accessibility reasons, just sniff for IE6 and replace the animation with a generic show() and hide() instead. I recommend avoiding complicated code for edge cases that don't matter.

like image 31
Ryan McGeary Avatar answered Nov 15 '22 13:11

Ryan McGeary