【问题标题】:Slide div Move Left to right, right to left and after it is in center using jquery滑动 div 从左向右移动,从右向左移动,然后使用 jquery 居中
【发布时间】:2013-09-01 11:56:02
【问题描述】:

我在此包含消息中创建了具有字体样式类的 div。例如:

<div class="font-style" style=position:relative>
Hi all How are you !!!
</div>

而 Jquery 是

   jQuery('.font-style').css({'right': '0px', 'left': '300px'}).animate({
                                    'right': '300px'
                                });
                                jQuery('.font-style').css({'right': '300px', 'left': '0px'}).animate({
                                    'left': '300px'
                                });

在加载时,它出现在中心,然后从右向左移动,然后从左向右移动。它工作完美,但我的问题是如何在它从左到右移动后使其成为中心。

Demo

【问题讨论】:

  • 最好为此提供一个小提琴
  • 动画开始前字体样式加载的css是什么?
  • @Rex 我用小提琴编辑了我的问题

标签: javascript jquery jquery-ui slide


【解决方案1】:
  jQuery('.font-style').animate({
  'right': '300px'
  },'slow').animate({
  'left': '300px'
  },'slow').animate({
  'left': '0',
  'right': '0'
  });


<div style="width:100%" id="p">
<div class="font-style" style=position:relative>Hi all How are you !!!</div>
</div>


#p{text-align:center;}
font-style{
}

http://jsfiddle.net/LRSbZ/

【讨论】:

    【解决方案2】:

    试试这个DemoHere,对你更有帮助

    【讨论】:

    • 我没看到的演示在哪里?
    • +1 感谢提供演示,但它不断地移动。我不确定在从左到右和从右到左单独移动后有没有办法停下来
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-12
    • 1970-01-01
    • 2015-08-25
    • 1970-01-01
    相关资源
    最近更新 更多