jQuery slideUp/slideDown问题 [英] jQuery slideUp/slideDown issue

查看:110
本文介绍了jQuery slideUp/slideDown问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在制作jQuery滑块时遇到问题,我有一个显示相应信息的链接列表.不同的链接具有不同的内容,因此具有不同的高度.

Been having a problem making a jQuery slider, I have a list of links that reveal the corresponding information. Different links have different content, so have different heights..

它可以工作,但是我遇到的问题是,当附加了不同高度的新内容时,slideDown()滑到先前内容的高度(尽管那里有新内容!),然后急速回到正确的位置高度?同样,当发生这种情况时,我的关闭"按钮将不再起作用.

It works but the problem I'm having is when new content of a different height is appended, the slideDown() slides to the height of the previous content (although the new content is there!) then jerks back to the correct height? Also when this happens my 'close' button no longer works.

  $('#timelineDataContainer').slideUp(400,function(){
    $('#timelineData').queue(function(){
      $(this).html('')
        .append('Some new content here....')
        .dequeue();
    });
  });
 $('#timelineDataContainer').slideDown();

这是jFiddle的一个有效示例

Here is a working example from jFiddle

http://jsfiddle.net/Xu6B4/9/

任何帮助将不胜感激!

推荐答案

您正在调用SlideDown()而不等待SlideUp()完成.

You are calling the SlideDown() without waiting for SlideUp() to finish.

这应该可以正常工作: http://jsfiddle.net/Xu6B4/12/

This should be working as expected: http://jsfiddle.net/Xu6B4/12/

这篇关于jQuery slideUp/slideDown问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆