標籤:
<!DOCTYPE html><html ng-app="plunker"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="format-detection" content="telephone=no"> <title>FrozenUI Demo</title> <link rel="stylesheet" href="css/frozen.css"> <script type="text/javascript" src="js/angular.min.js"></script> <script> var app = angular.module(‘plunker‘, []); app.controller("slideController",function(){ var i=0; window.onscroll = function(e){//滾動事件 var oScrollTop=document.body.scrollTop;//捲軸距離頁面頂部高度(滾動了多少高度) var oWindowHeight=document.documentElement.clientHeight;//可視區高度 var oDocumentHeight=document.documentElement.offsetHeight;//當前元素高度 // console.log(angular.element(document.documentElement.scrollTop));//Firefox下擷取滾動高度 if(oScrollTop==oDocumentHeight-oWindowHeight){//判斷條件---捲軸距離頁面頂部高度等於當前元素高度減去可視區高度 //商務邏輯 i++; console.log(e); console.log(angular.element(document.body.scrollTop));//chrome下擷取滾動高度 angular.element(document.querySelector("p")).wrap( "<div class=‘new‘>11111111111</div>" ); } }; }) </script> </head> <body ng-controller="slideController"> <p style="height:1000px">p</p> <!-- <p id="id1">id</p> <p class="class1">class</p> --> </body></html>
移動端滾動翻頁