开发者

jQuery slideToggle() applies display:block while sliding

开发者 https://www.devze.com 2023-03-05 13:55 出处:网络
I have a page that\'s like a discussion where you can make posts and reply to those posts. When there are more than 2 replies, I show the two most recent ones and hide the rest by default. There\'s a

I have a page that's like a discussion where you can make posts and reply to those posts. When there are more than 2 replies, I show the two most recent ones and hide the rest by default. There's a button that will let you expand/collapse the extra replies that uses jQuery's slideToggle function. It's operating on an unordered list of tables, where each table contains the comment along with the user's name and some other info.

Here's the problem: While the tables are actually sliding up or down, the first table in the list looks like its width has been set to auto, so it shrinks. Once it's done s开发者_开发知识库liding, the formatting looks fine; it's just during the actual sliding that this happens. I'm assuming it's being set to 'display:block' or something during the slide but I don't know that for sure.

Is there a way to control what the display type is during the animation?

//this is what happens when you click the 'View all X replies' or 'Hide replies' button
        $(".expandOverflow").click(function()
    {
                $(".overflowlist" + overflowListTarget).slideToggle(16000/*, function(){$(this).css('display', 'inline');}*/);
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号