This article mainly introduces how to implement the scroll bar effect in JavaScript. It involves some techniques related to javascript operations on html elements to implement scrolling. It is very useful. For more information, see
This article mainly introduces how to implement the scroll bar effect in JavaScript. It involves some techniques related to javascript operations on html elements to implement scrolling. It is very useful. For more information, see
This article describes how to implement the scroll bar effect in JavaScript. Share it with you for your reference. The details are as follows:
Script window. onload = function () {var oDiv = document. getElementById ('p1'); var oUl = oDiv. getElementsByTagName ('ul ') [0]; var oLi = oUl. getElementsByTagName ('lil'); var oLeft = document. getElementById ('leftdiv '); var oright = document. getElementById ('rightdiv '); oUl. innerHTML + = oUl. innerHTML; oUl. style. width = oLi [0]. offsetWidth * oLi. length + 'px '; var speed =-2; function move () {if (oUl. offsetLeft <-oUl. offsetWidth/2) {oUl. style. left = '0';} else if (oUl. offsetLeft> 0) {oUl. style. left =-oUl. offsetWidth/2 + 'px ';} oUl. style. left = oUl. offsetLeft + speed + 'px ';}; var timer = setInterval (move, 30); oLeft. onclick = function () {speed =-2 ;}; oright. onclick = function () {speed = 2 ;}; oUl. onmouseover = function () {clearInterval (timer) ;}; oUl. onmouseout = function () {timer = setInterval (move, 30) ;};} script
I hope this article will help you design javascript programs.
,