<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
.txt {width: 20px;margin:0 auto;}
</style>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function(){
var textScroll = function(selector) {
var stepTime = 1000, //动画执行时间
intervalTime = stepTime * 2,
$text = $(selector);
$text.css("position","relative");
setInterval(function(){
$text.animate({
top:‘100px‘}, stepTime, ‘linear‘, function(){
$text.animate({top:0}, stepTime)
}
)
}, intervalTime);
};
textScroll (".box");
// textScroll (".box");//增加用
});
</script>
<div class="box">
<div class="txt">
我就是要上下跳动
</div>
</div>
</body>
</htm>