javascript - 如何从右向左滑动 JQuery HTML CSS

标签 javascript jquery html css slide

$(document).ready(function() {
  $("#One").click(function() {
    $("#Two").animate({
      width: 'toggle'
    }, -10);
  });
});
<script src="jquery-3.2.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-
    3.2.1.min.js"></script>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://jquery-
    ui.googlecode.com/svn/tags/latest/ui/jquery.effects.core.js"></script>
<script src="http://jquery-
    ui.googlecode.com/svn/tags/latest/ui/jquery.effects.slide.js">
</script>
<script>
</script>

<div id="One" style="width:50px;height:200px;background-
     color:yellow;position:relative;top:300px;left:600px;">One</div>
<div id="Two" style="width:200px;height:200px;background-
    color:black;position:relative;top:100px;left:400px;">Two</div>

上面是代码,我的问题就是无法正常滑动。当我点击它时它消失然后在第二次点击时返回。我只是想让它正常滑动。

最佳答案

尝试添加这个::

$(document).ready(function() {
  $("#One").click(function() {
    $("#Two").animate({
      left: '400px'
    });
  });
});

关于javascript - 如何从右向左滑动 JQuery HTML CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47608041/

相关文章:

javascript - 无法将动画附加到网格?

javascript - Openlayers 3 性能指标

javascript - 将变量比较分配给 if/else 语句

javascript - 自动排列div,同时放大一个div

javascript - 从 jquery 插件调用函数

html - 这句话是什么意思? -->"font:12px/1.5\5fae\8f6f\96c5\9ed1;",我想不通

javascript - jQuery `.click()` 不工作

javascript - 如何在页面加载后动态生成的 DOM 对象上触发事件

javascript - Ajax脚本接收用户字符串输入文本并以JSON格式发布

html - Bootstrap 4 : Dropdown menu href link not going to href location