<HTML>
<HEAD>
<STYLE TYPE='text/css'>
#myChaser {
position:absolute;
left:200px;
top:0px;
width:250px;
color:#555555;
font-size:12px;
}
</STYLE>
</HEAD><BODY>
<DIV ID='myChaser'>
位置相对固定的层,可以任意设置。</DIV>
<SCRIPT LANGUAGE='JavaScript'>
var oChaser = {
topMargin : 25,
callRate : 10,
slideTime : 1200,
maxDiff : document.all ? document.body.clientHeight : window.innerHeight,
isIE : document.all ? true : false,
chaserDiv : document[document.all ? "all" : "layers"]["myChaser"]
}window.setInterval("oChaser.main( )", oChaser.callRate)
oChaser.main = function( )
{
this.currentY = this.isIE ? this.chaserDiv.style.pixelTop : this.chaserDiv.top
this.scrollTop = this.isIE ? document.body.scrollTop : window.pageYOffset
var newTargetY = this.scrollTop + this.topMargin if ( this.currentY != newTargetY ) { if ( newTargetY != this.targetY ) {
this.targetY = newTargetY
this.slideInit()
}
this.slide()
}
}
oChaser.slideInit = function( )
{
var now = new Date( )
this.A = this.targetY - this.currentY
this.B = Math.PI / ( 2 * this.slideTime )
this.C = now.getTime( ) if (Math.abs(this.A) > this.maxDiff) {
this.D = this.A > 0 ? this.targetY - this.maxDiff : this.targetY + this.maxDiff
this.A = this.A > 0 ? this.maxDiff : -this.maxDiff
} else {
this.D = this.currentY
}
}oChaser.slide = function( )
{
var now = new Date( )
var newY = this.A * Math.sin( this.B * ( now.getTime( ) - this.C ) ) + this.D
newY = Math.round( newY ) if (( this.A > 0 && newY > this.currentY ) ||( this.A < 0 && newY < this.currentY )) {
if ( this.isIE )this.chaserDiv.style.pixelTop = newY
else this.chaserDiv.top = newY
}
}
</SCRIPT>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
</BODY>
</HTML>
<HEAD>
<STYLE TYPE='text/css'>
#myChaser {
position:absolute;
left:200px;
top:0px;
width:250px;
color:#555555;
font-size:12px;
}
</STYLE>
</HEAD><BODY>
<DIV ID='myChaser'>
位置相对固定的层,可以任意设置。</DIV>
<SCRIPT LANGUAGE='JavaScript'>
var oChaser = {
topMargin : 25,
callRate : 10,
slideTime : 1200,
maxDiff : document.all ? document.body.clientHeight : window.innerHeight,
isIE : document.all ? true : false,
chaserDiv : document[document.all ? "all" : "layers"]["myChaser"]
}window.setInterval("oChaser.main( )", oChaser.callRate)
oChaser.main = function( )
{
this.currentY = this.isIE ? this.chaserDiv.style.pixelTop : this.chaserDiv.top
this.scrollTop = this.isIE ? document.body.scrollTop : window.pageYOffset
var newTargetY = this.scrollTop + this.topMargin if ( this.currentY != newTargetY ) { if ( newTargetY != this.targetY ) {
this.targetY = newTargetY
this.slideInit()
}
this.slide()
}
}
oChaser.slideInit = function( )
{
var now = new Date( )
this.A = this.targetY - this.currentY
this.B = Math.PI / ( 2 * this.slideTime )
this.C = now.getTime( ) if (Math.abs(this.A) > this.maxDiff) {
this.D = this.A > 0 ? this.targetY - this.maxDiff : this.targetY + this.maxDiff
this.A = this.A > 0 ? this.maxDiff : -this.maxDiff
} else {
this.D = this.currentY
}
}oChaser.slide = function( )
{
var now = new Date( )
var newY = this.A * Math.sin( this.B * ( now.getTime( ) - this.C ) ) + this.D
newY = Math.round( newY ) if (( this.A > 0 && newY > this.currentY ) ||( this.A < 0 && newY < this.currentY )) {
if ( this.isIE )this.chaserDiv.style.pixelTop = newY
else this.chaserDiv.top = newY
}
}
</SCRIPT>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
</BODY>
</HTML>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货