简体   繁体   English

jQuery slideDown函数在动画结束时垂直跳转

[英]jQuery slideDown function vertical jump at end of animation

I have researched this problem extensively and have not been able to find an answer to this. 我已经广泛研究了这个问题,却无法找到答案。

Here is a JSFiddle showing the issue I am having: 这是一个JSFiddle,显示了我遇到的问题:

http://jsfiddle.net/8cfLa8tk/ http://jsfiddle.net/8cfLa8tk/

You will notice that every time you click the button to add the link, it will add it but then jump at the end of the animation. 您会注意到,每次单击按钮添加链接时,它都会添加该链接,但是会跳到动画的末尾。

I want to have the link appended, be hidden, then have the slideDown animation reveal the link without it jumping and I am pulling my hair out here trying to figure out the issue. 我想附加链接,将其隐藏,然后让slideDown动画显示该链接而不跳动,我在这里拉头发试图找出问题。

and because it's forcing me to write code here even though it won't make sense without the HTML and CSS: 并且因为这迫使我在这里编写代码,即使没有HTML和CSS也无济于事:

links++;
    $('#some_links').append('<li id="link_' + links + '"></li>');
    $('<div style="display:none;"><a href="#">Link ' + links + '</a></div>')
        .appendTo($('#link_' + links))
        .slideDown('fast');

Add vertical-align: bottom; 添加vertical-align: bottom; to #some_links li FIDDLE #some_links li FIDDLE

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM