87,904
社区成员
发帖
与我相关
我的任务
分享
<!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=utf-8" />
<script type="application/javascript" src="js/jquery.js"></script>
<script>
$(function(){
donghua();
setInterval(donghua,'1000');
setInterval(dingshiqi,'100');
});
function donghua()
{
$('.round_1').animate({left:"-=10px"},'3000');
}
function dingshiqi()
{
if($('.round_1').css('left')=='730px')
{
$('.round_1').css('left','1920px');
}
}
</script>
<title>无标题文档</title>
</head>
<style>
.content
{
width:950px; height:900px;
}
.wrap_content
{
width:1920px; height:900px; position:absolute; margin-left:-485px;
}
.jueduidingwei
{
position:absolute;
}
.round_1 {
border-radius: 15px; /* 所有角都使用半径为5px的圆角,此属性为CSS3标准属性 */
-moz-border-radius: 15px; /* Mozilla浏览器的私有属性 */
-webkit-border-radius: 15px; /* Webkit浏览器的私有属性 */
background:#000;
width:15px; height:15px;
border-radius: 15px 15px 15px 15px; /* 四个半径值分别是左上角、右上角、右下角和左下角 */
}
</style>
<body>
<div class="content">
<div class="wrap_content">
<div class="round_1 jueduidingwei" style="left:720px; top:200px;"></div>
</div>
<div style="width:900px; height:900px;"></div>
</div>
</body>
</html>
function donghua()
{
$('.round_1').animate({left:"-=10px"},'3000','linear', donghua);
}
或者用递归,函数改成function donghua()
{
$('.round_1').animate({left:"-=10px"},'3000','linear');
return donghua();
}
都可以实现,速度的话有fast,normal这是字符串,你给成"2000”也是字符串,应该是2000,200,1000,100等等整数毫秒,这样速度就变了,或者改变位移的像素也可以