移動端滾動翻頁

來源:互聯網
上載者:User

標籤:

<!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>

  

移動端滾動翻頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.