js跟随滚动条滚动浮动代码

(编辑:jimmy 日期: 2024/10/13 浏览:2)

复制代码 代码如下:
var str="客服";
var objFT=new FloatT("FloatMenu1",str,942,137,125,200,80,10);
objFT.FloatRun();


//js跟随滚动条滚动 浮动
//pObjName:html 元素ID
//pText:html 元素内容
//其它自己看
function FloatT(pObjName,pText,pstmnLEFT,pstmnGAP1,pstmnGAP2,pstmnBASE,pstmnActivateSpeed,pstmnScrollSpeed)
{
var FloatMenu;
var stmnLEFT = pstmnLEFT;
var stmnGAP1 = pstmnGAP1;
var stmnGAP2 = pstmnGAP2;
var stmnBASE = pstmnBASE;
var stmnActivateSpeed = pstmnActivateSpeed;
var stmnScrollSpeed = pstmnScrollSpeed;

this.FloatRun=function(pObjName)
{
var newDiv=document.createElement("div");
newDiv.id=pObjName;
newDiv.innerHTML=pText;
newDiv.style.position="absolute";
document.body.appendChild(newDiv);
FloatMenu=document.getElementById(pObjName);
FloatMenu.style.display=="";
FloatMenu.style.top = document.documentElement.scrollTop + stmnBASE+"px";

FloatMenu.style.left = stmnLEFT+"px";
RefreshStaticMenu();
}

RefreshStaticMenu=function()
{
var stmnStartPoint,stmnEndPoint,stmnRefreshTimer;

stmnStartPoint = parseInt(FloatMenu.style.top, 10);
stmnEndPoint = document.documentElement.scrollTop + stmnGAP2;
if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

if(stmnStartPoint != stmnEndPoint)
{
stmnScrollAmount = Math.ceil(Math.abs(stmnEndPoint - stmnStartPoint) / 15 );
FloatMenu.style.top = parseInt(FloatMenu.style.top, 10) + ((stmnEndPoint<stmnStartPoint) ? -stmnScrollAmount : stmnScrollAmount)+"px";
stmnRefreshTimer = stmnScrollSpeed;
}
else
{
stmnRefreshTimer = stmnActivateSpeed;
}
setTimeout("RefreshStaticMenu();", stmnRefreshTimer);
}
}

一句话新闻

Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。