html鼠标滚动实现页面切换,实现鼠标滚动一下页面就上下翻一页的效果 |
您所在的位置:网站首页 › js鼠标滚动上下切换页面 › html鼠标滚动实现页面切换,实现鼠标滚动一下页面就上下翻一页的效果 |
Document
*{ margin: 0; padding: 0; } html,body{ width: 100%; height: 100%; } .page{ height: 100%; width: 100%; font-size: 126px; display: -webkit-box; /*Safari*/ display: -moz-box; /*Firefox*/ display: -ms-flexbox; /*IE*/ display: -webkit-flex; /*Chrome*/ display: flex; -webkit-box-align: center; -moz-box-align: center; -ms-flex-align: center; -webkit-align-items: center; align-items: center; -webkit-box-pack: center; -moz-box-pack: center; -ms-flex-pack: center; -webkit-justify-content: center; justify-content: center; } #mao{ position: fixed; right: 0; bottom: 0; } Prat 1 Prat 2 Prat 3 Prat 4 Prat 5 Prat 6 Prat 7//var oldy = 0,tem = 0,fullheight = document.body.clientHeight; //window.onscroll = function() { //var y = document.documentElement.scrollTop || document.body.scrollTop; //console.log('this is y' + y); //if (y > oldy) { //location.href = '#item-4'; //console.log('向下翻'); //oldy = y; //} else if (y < oldy) { document.body.scrollTop-=fullheight;console.log('向上翻');oldy=y; //} else { //console.log('翻你妹啊'); //console.log('xiangdeng'); //} // //console.log('this is oldy' + oldy); //} var scrollFunc = function(e) { ee = e || window.event; var t1 = document.getElementById("wheelDelta"); var t2 = document.getElementById("detail"); var y = document.documentElement.scrollTop || document.body.scrollTop; var fullheight = document.body.offsetHeight; if (e.wheelDelta) { //IE/Opera/Chrome var a = e.wheelDelta;//向上为120,向下为-120 if(a>0){//向上 document.body.scrollTop -= fullheight/2; } if(a |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |