大半夜上来求助,请教一下怎么把这个js写成隐藏模式
本帖最后由 u011301448 于 2013-12-07 02:34:35 编辑
请问一下如何把以下代码写成 默认在隐藏起来 鼠标放上去又显示
谢谢啦。。。
function play() {
var ps = document.documentElement.scrollTop < marginTop ? marginTop : document.documentElement.scrollTop;
if(objY > ps) {
objY -= moveSpeed;
if(objY < ps) objY = ps;
}
else {
objY += moveSpeed;
if(objY > ps) objY = ps;
}
if(objL) objL.style.top = objY + "px";
}
var marginTop = 0;
var marginSide = 0;
var moveSpeed = 25;
var objY = marginTop;
var objL = document.getElementById("kf");
var isUse = false;
if(objL) {
objL.style.position = "absolute";
objL.style.left = marginSide + "px";
isUse = true;
}
if(isUse) setInterval(this.play,30);
------解决方案--------------------function play() {
var ps = document.documentElement.scrollTop < marginTop ? marginTop : document.documentElement.scrollTop;
if(objY > ps) {
objY -= moveSpeed;
if(objY < ps) objY = ps;
}
else {
objY += moveSpeed;
if(objY > ps) objY = ps;
}
if(objL) objL.style.top = objY + "px";
}
var marginTop = 0;
var marginSide = -30; ///////////自己依据宽度定义这个隐藏的内容宽度
var moveSpeed = 25;
var objY = marginTop;
var objL = document.getElementById("kf");
var isUse = false;
if(objL) {
objL.style.position&nbs