DIV 自动滚动功能及滚动条颜色修改

编程爱好者联盟 2016-11-04

1.DIV 自动滚动

<script type="text/javascript"> function startmarquee(lh, speed, delay) { var t; var oHeight = 300; /** div的高度 **/ var p = false; var o = document.getElementById("show"); var preTop = 0; o.scrollTop = 0; function start() { t = setInterval(scrolling, speed); o.scrollTop += 1; } function scrolling() { if (o.scrollTop % lh != 0 && o.scrollTop % (o.scrollHeight - oHeight - 1) != 0) { preTop = o.scrollTop; o.scrollTop += 1; if (preTop >= o.scrollHeight || preTop == o.scrollTop) { o.scrollTop = 0; } } else { clearInterval(t); setTimeout(start, delay); } } setTimeout(start, delay); } window.onload = function () { /**startmarquee(一次滚动高度,速度,停留时间);**/ startmarquee(20, 40, 50); } </script>

 <div id="show" style="height: 600px; width: 100%; overflow-y: scroll;scrollbar-base-color:#ffffff;SCROLLBAR-HIGHLIGHT-COLOR:#ffffff;SCROLLBAR-ARROW-COLOR:#ffffff; overflow-x: none;"></div>

2.滚动条颜色

scrollbar-3d-light-color 设置或检索滚动条亮边框颜色 crollbar-highlight-color 设置或检索滚动条3D界面的亮边(ThreedHighlight)颜色scrollbar-face-color 设置或检索滚动条3D表面(ThreedFace)的颜色 scrollbar-arrow-color 设置或检索滚动条方向箭头的颜色scrollbar-shadow-color 设置或检索滚动条3D界面的暗边(ThreedShadow)颜色 scrollbar-dark-shadow-color 设置或检索滚动条暗边框(ThreedDarkShadow)颜色 scrollbar-base-color 设置或检索滚动条基准颜色。

备注:该信息摘自网络

相关推荐