<= (dragT + dragH))){ clickDrag = true; return false} else if(mouseX >= dragL && (mouseX <= (dragL + dragW)) && mouseY >= rulerT && (mouseY <= (rulerT + scrollH))){ if(mouseY < dragT){clickAbove = true;clickUp = true;return scrollUp()} else{clickBelow = true;clickDown = true; return scrollDown()}} else{return true}} function move(e){ if(clickDrag && contentH > contentClipH){ getMouse(e); dragT = (mouseY - startY); if(dragT < (rulerT)) dragT = rulerT; if(dragT > (rulerT + scrollH - dragH)) dragT = (rulerT + scrollH - dragH); contentT = ((dragT - rulerT)*(1/scrollLength)); contentT = eval('-' + contentT); moveTo(); if(ie4) return false}} function up(){ clearTimeout(timer); clickUp = false; clickDown = false; clickDrag = false; clickAbove = false; clickBelow = false; return true; } function getT(){ if(ie4) contentT = document.all.scrollerContent.style.pixelTop; else if(nn4) contentT = document.scrollerContentClip.document.scrollerContent.top; else if(dom) contentT = parseInt(document.getElementById("scrollerContent").style.top); } function getMouse(e){ if(ie4){ mouseY = event.clientY + document.body.scrollTop; mouseX = event.clientX + document.body.scrollLeft; } else if(nn4 || dom){ mouseY = e.pageY; mouseX = e.pageX; } } function moveTo(){ if(ie4){ document.all.scrollerContent.style.top = contentT; document.all.ruler.style.top = dragT; document.all.drag.style.top = dragT; } else if(nn4){ document.scrollerContentClip.document.scrollerContent.top = contentT; document.ruler.top = dragT; document.drag.top = dragT; } else if(dom){ document.getElementById("scrollerContent").style.top = contentT + "px"; document.getElementById("drag").style.top = dragT + "px"; document.getElementById("ruler").style.top = dragT + "px"; } } function scrollUp(){ getT(); if(clickAbove){ if(dragT <= (mouseY-(dragH/2))) return up(); } if(clickUp){ if(contentT < 0){ dragT = dragT - (speed*scrollLength); if(dragT < (rulerT)) dragT = rulerT; contentT = contentT + speed; if(contentT > 0) contentT = 0; moveTo(); timer = setTimeout("scrollUp()",25)}} return false;} function scrollDown(){ getT(); if(clickBelow){ if(dragT >= (mouseY-(dragH/2))) return up()} if(clickDown){ if(contentT > -(contentH - contentClipH)){ dragT = dragT + (speed*scrollLength); if(dragT > (rulerT + scrollH - dragH)) dragT = (rulerT + scrollH - dragH); contentT = contentT - speed; if(contentT < -(contentH - contentClipH)) contentT = -(contentH - contentClipH); moveTo(); timer = setTimeout("scrollDown()",25)}} return false} function reloadPage(){ location.reload()} function eventLoader(){ if(ie4){ upL = document.all.up.style.pixelLeft; upT = document.all.up.style.pixelTop; downL = document.all.down.style.pixelLeft; downT = document.all.down.style.pixelTop; dragL = document.all.drag.style.pixelLeft; dragT = document.all.drag.style.pixelTop; rulerT = document.all.ruler.style.pixelTop; contentH = parseInt(document.all.scrollerContent.scrollHeight); contentClipH = parseInt(document.all.scrollerContentClip.style.height); } else if(nn4){ upL = document.up.left; upT = document.up.top; downL = document.down.left; downT = document.down.top; dragL = document.drag.left; dragT = document.drag.top; rulerT = document.ruler.top; contentH = document.scrollerContentClip.document.scrollerContent.clip.bottom; contentClipH =。
8.js如何写自己的滚动条由于网页中使用到了iframe , 如果iframe中的内容超过主页面的范围后 , 在iframe的四周会出现滚动条 , 这样和主页面很不协调 , 所以在网上找了很久 , 终于找到一段代码可以解决这个问题 , 代码如下:这段代码放在之间:下边是在iframe中输入的代码:代码的关键是:设置id 调用js中的函数(dyniframesizeHeight(id)是设置高的滚动条自动调整 , dyniframesizeWidth(id)是设置宽的滚动条的自动调整 。)
将scrolling=no 其他就看实际应用做相应的修改了; 。
文章插图
- 粉条炒肉 白菜粉条炒肉
- 百夫长黑卡 百夫长黑卡办理条件
- 我的爱没了解 我的爱没了解你在哪一条街
- 土豆面条 西红柿土豆面条
- 荆条蜂蜜 荆条蜂蜜真假辨别
- 我被家里的狗狗进入了小说 那条狗跟着主人进了屋
- 第七条猎犬 第七条猎犬的读后感400字
- 护士帽上三条杠是什么职务 护士帽上三条斜杠是什么职务
- 刺客信条4存档位置 刺客信条4存档位置在哪
- 猪肉炖粉条是哪个地方的菜 猪肉炖粉条是哪个地方的菜啊