var timer1=null;
var timer2=null;
var il=200;
var ir=600;
timer1=setInterval('scrl()',100)
function scrl()
{
if(il<=1)
{
clearTimeout(timer1);
document.getElementById('popl').style.left='0px';
document.getElementById('popr').style.left='0px';
}
else
{
il=il/2;
ir=ir/2;
document.getElementById('popl').style.left=il+'px';
document.getElementById('popr').style.left=-ir+'px';
}
}
function scrlr(n)
{
lj=n;
timer2=setTimeout('scrr()',20);
}
function scrr()
{
timer2=setTimeout('scrr()',20);
if(il>=600)
{
clearTimeout(timer2);
document.getElementById('popl').style.left='155px';
document.getElementById('popr').style.left='-654px';
location.href=lj;
}
else
{
il=il*2;
ir=ir*2;
document.getElementById('popl').style.left=il+'px';
document.getElementById('popr').style.left=-ir+'px';
}
}
<a onclick="scrlr('index.html')">index页面</a>
转载:http://www.clickharbour.com/page/ptext.html 查看源代码
次效果是由循环不同定位的位置达到的滑动效果。