1,
meta:vp 按tab
生成:
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
2 泵三,html
圖片.png
3烫幕,css
圖片.png
4较曼,js
用戶滑動(dòng)的時(shí)候,幫用戶滑動(dòng)
下面就是窗口滑動(dòng)的代碼 window.scrollTo(x,y) x,y是水平冕末,垂直的滑動(dòng)
setTimeout(function(){
window.scrollTo(0,1300)
},1000)
圖片.png
那么只要滑動(dòng)一個(gè)屏幕的高度就可以:
不知道档桃,Google搜索 :js get viewport height
圖片.png
圖片.png
http://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript
圖片.png
setTimeout(function(){
var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
window.scrollTo(0,h)
},1000)
console.log(document.documentElement.clientHeight)
console.log(window.innerHeight)
這樣1秒后就是滾動(dòng)一個(gè)屏幕的高度
圖片.png
上面這個(gè)只是一種實(shí)現(xiàn)思路,但是實(shí)際上這樣使用不能實(shí)現(xiàn)幫用戶滾動(dòng)屏幕
圖片.png
http://stackoverflow.com/questions/31223341/javascript-detecting-scroll-direction
圖片.png
圖片.png
下滾數(shù)字變大 上滾數(shù)字變小
scroll是無法解決,實(shí)現(xiàn)這個(gè)功能的
優(yōu)
滾輪事件
click