<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Simple jQuery scrolling function by Max Vergelli</title>
<style>
body, div, p, ul, li {margin: 0px;padding: 0px;}
div.jp-title{
position:relative;
height:24px;
display:block;
overflow:hidden;
border:#CCCCCC 1px solid;
}
.scrollingtext1{
position:absolute;
white-space:nowrap;
font-family:'Trebuchet MS',Arial;
font-size:18px;
font-weight:bold;
color:#000000;
}
.scrollingtext2, .scrollingtext3{
position:absolute;
white-space:nowrap;
font-family:'Trebuchet MS',Arial;
font-size:18px;
font-weight:bold;
color:#000000;
visibility:hidden;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$( "#clickme" ).click(function() {
var ob = $('.scrollingtext1');
var tw = ob.width();
var ww = ob.parent().width();console.log(tw);
ob.css({ left: -tw });
ob.animate({ left: ww}, 20000, 'linear', function() {
$('.scrollingtext2').css('visibility' ,'visible');
});
});
});
</script>
</head>
<body>
<div class="jp-title">
<ul>
<li class="scrollingtext1">
scrolling text1: scrolling text1 scrolling text1 scrolling text1 scrolling text1 </li>
</ul>
<li class="scrollingtext2">
scrolling text2: scrolling text2 scrolling text2 scrolling text2 scrolling text2</li>
</ul>
<li class="scrollingtext3">
scrolling text3: scrolling text3 scrolling text3 scrolling text3 scrolling text3</li>
</ul>
</div>
<div id="clickme">
Click here
</div>
</body>
</html>
问题:
我想做这个功能:一开始只scrollingtext1
显示,第一次点击右移,Click here
显示,第二次点击右移,第三次显示单击,将向右移动并显示,然后循环继续。scrollingtext1
scrollingtext2
Click here
scrollingtext2
scrollingtext3
Click here
scrollingtext3
scrollingtext1
以上是我当前的代码,我被困在这里。谁能帮我这个?谢谢。