javascript - 如何用jquery制作文本向右滑动的动画

标签 javascript jquery

所以我记录正确和错误的答案,并且我想从屏幕右侧滑动文本。

这是我所拥有的,但它不起作用:

document.getElementById('total').innerHTML = "Number of Right Answers: " + right;
document.getElementById('totalw').innerHTML = "Number of Wrong Answers: " + wrong;
$("#total").show("slide", {
  direction: "right"
}, 2000);
$("#totalw").show("slide", {
  direction: "right"
}, 2000);
<div id="total"></div>
<div id="totalw"></div>

最佳答案

在html文件中添加:

$('#total').html("Number of Right Answers: " + "right");
$('#totalw').html("Number of Wrong Answers: " + "wrong");
$("#total").show('slide', {direction: 'right'}, 1000);
$("#totalw").show( "slide", {direction: "right" }, 2000 );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.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>
<div id="total"></div>
<div id="totalw"></div>

关于javascript - 如何用jquery制作文本向右滑动的动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29615503/

相关文章:

javascript - Twitter Bootstrap Transition Conflict prototypejs

jquery - Ajax 请求不适用于数据表分页

php - 使用没有日期的 FullCalendar

php - 为什么 javascript 不能使用我在 php 文件中声明的 javascript 变量?

javascript - 函数不进入else

javascript - 原型(prototype)添加事件监听器

javascript - 平滑滚动效果在 iOS 上的 iframe 中不起作用

javascript - flickrapi (js) 循环中的多个异步调用

javascript - 在哪里以安全的方式将 JWT token 存储在 react /客户端?

Javascript - 正则表达式不一致匹配