文字连续向上循环滚动
view 代码 例子:
<div id="de" style="overflow:hidden; width:128px; height:300px;"> <div id="de1"> <ul class="right-middle"> <li> <p> <a href="" class="avatar" target="_blank"> <img src="/Images/product/pic1.jpg" alt="javascript的类型转换规则"> </a> <span>原文地址Javascript类型转换的规则</span> </p> </li> <li> <p> <a href="" class="avatar" target="_blank"> <img src="/Images/product/pic1.jpg" alt="javascript的类型转换规则"> </a> <span>原文地址Javascript类型转换的规则</span> </p> </li> <li> <p> <a href="" class="avatar" target="_blank"> <img src="/Images/product/pic1.jpg" alt="javascript的类型转换规则"> </a> <span>原文地址Javascript类型转换的规则</span> </p> </li> <li> <p> <a href="" class="avatar" target="_blank"> <img src="/Images/product/pic1.jpg" alt="javascript的类型转换规则"> </a> <span>原文地址Javascript类型转换的规则</span> </p> </li> <li> <p> <a href="" class="avatar" target="_blank"> <img src="/Images/product/pic1.jpg" alt="javascript的类型转换规则"> </a> <span>原文地址Javascript类型转换的规则</span> </p> </li> </ul> </div> <div id="de2"></div> </div>
javascript 实现滚动效果:
<script> var dome = document.getElementById("de"); var dome1 = document.getElementById("de1"); var dome2 = document.getElementById("de2"); var speed = 50;//设置向上轮动的速度 dome2.innerHTML = dome1.innerHTML;//复制节点 function moveTop() { if (dome1.offsetHeight - dome.scrollTop <= 0) { dome.scrollTop = 0; } else { dome.scrollTop++; } } var myFunction = setInterval("moveTop()", speed); dome.onmouseover = function () { clearInterval(myFunction); }; dome.onmouseout = function () { myFunction = setInterval(moveTop, speed); }; </script>
相关推荐
songshijiazuaa 2020-09-01
Biao 2020-08-20
tomson 2020-06-26
Wmeng0 2020-06-14
choupiaoyi 2020-05-29
willowwgx 2020-05-18
yunfeitian 2020-04-18
zuihaobushi 2020-04-08
TreasureZ 2020-03-27
nxcjh 2020-02-19
ALiDan 2020-02-01
lmseohy 2020-01-13
waiwaiLILI 2020-01-12
xiaoxiaoCNDS 2020-01-08
ITxiaobaibai 2020-01-01
lxjhoney 2011-09-15
致终将努力的我们 2019-12-02