日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

点击鼠标上下滚动

發(fā)布時間:2023/12/20 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 点击鼠标上下滚动 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>無標題文檔</title> <style type="text/css"> #box{z-index: 10; width: 200px; position:relative; top:40px; } .img {height: 100px; width: 200px; border-bottom:1px solid #ccc; } .img img{ height: 100px; width: 200px; } input{ width: 200px; height: 40px; } #btn1{ top: 0;position: absolute;z-index: 10000 } #btn2{ bottom:0px;position: absolute;z-index: 10000 } #aa{ width: 200px; height: 280px;position:relative;overflow: hidden;} </style> </head> <script> window.onload = function(){var oBtn1 = document.getElementById('btn1')var oBtn2 = document.getElementById('btn2')var oBox = document.getElementById('box')var timerUp = null;var timerDown = null; function getStyle ( obj, attr ) { return obj.currentStyle?obj.currentStyle[attr] : getComputedStyle( obj )[attr]; }// 設(shè)置向上按鈕按下的動作 oBtn1.onmousedown = function(){timerUp = setInterval(function(){if (parseInt(getStyle(oBox , 'top')) > - 165) {oBox.style.top = parseInt(getStyle(oBox,'top')) - 5 +'px'} else {oBox.style.top = '-165px'}},100) } // 設(shè)置向上按鈕抬起的動作oBtn1.onmouseup = function(){clearInterval(timerUp)} // 設(shè)置按鈕按下的動作 oBtn2.onmousedown = function(){timerDown = setInterval(function(){if (parseInt(getStyle(oBox , 'top')) < 40) {oBox.style.top = parseInt(getStyle(oBox , 'top')) + 5 +'px';} else {oBox.style.top = '40px';}},100); } // 設(shè)置向下按鈕抬起的動作oBtn2.onmouseup = function(){clearInterval(timerDown)}} </script><body> <div id="aa"> <input id="btn1" type="button" value="上按鈕" /> <div id="box"><div class="img"><img src="img/1.png"></div><div class="img"><img src="img/2.png"></div><div class="img"><img src="img/3.png"></div><div class="img"><img src="img/4.png"></div> </div> <input id="btn2" type="button" value="下按鈕" /> </div> </body> </html>

  

轉(zhuǎn)載于:https://www.cnblogs.com/zhangli1021/p/8135021.html

總結(jié)

以上是生活随笔為你收集整理的点击鼠标上下滚动的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。