简体   繁体   English

如何使用jQuery为文本设置动画以向右滑动

[英]How to animate text with jquery to slide to the right

So I keep track of right and wrong answers and I want to slide the text from the right of the screen. 因此,我跟踪正确和错误的答案,并希望从屏幕右侧滑动文本。

Here is what I have, but it doesn't work: 这是我所拥有的,但是不起作用:

 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> 

add in file html: 添加文件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> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM