jQuery slideUp/slideDown issue

空扰寡人 提交于 2019-12-25 04:42:54

问题


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..

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();

Here is a working example from jFiddle

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

Any help would be appreciated!


回答1:


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

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



来源:https://stackoverflow.com/questions/3746536/jquery-slideup-slidedown-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!