Thursday, October 24, 2013

scroll position mobile



<head> 

<title>vivekmras.webhostingbuilders.com</title> 

        <meta name="viewport" content="width=device-width,user-scalable=no">

        <script src="viscpt.js"></script>

</head> 

<body> 

  

<!-- Start of first page: #one -->

<div data-role="page" id="one">

<div data-role="content" >

<h2>One</h2>

                <div id="div1"></div>

<label for="text-1">Text input:</label>

     <input type="text" name="text-1" id="text-1" value="">

     

     

     <div data-role="collapsible" data-collapsed="false" data-theme="b" data-content-theme="d">

    <h4>Heading</h4>

    <ul data-role="listview">

        <li><a href="#">List item 1</a></li>

        <li><a href="#">List item 2</a></li>

        <li><a href="#">List item 3</a></li>

    </ul>

</div>

     

     

</div><!-- /content -->

<div data-role="footer" data-theme="d">

<h4>Page Footer</h4>

</div><!-- /footer -->

</div><!-- /page one -->

<script>

    window.onload = function() {

         var d = document.getElementById("div1");

var topPos = d.offsetTop;

/

    console.log("onload--  document.body.scrollTop="+document.body.scrollTop);

    console.log("onload-- window.innerHeight="+window.innerHeight);

    console.log("onload-- document.body.scrollHeight="+document.body.scrollHeight);

};

window.onresize=function(){

         var d = document.getElementById("div1");

var topPos = d.offsetTop;

    console.log("onresize--  document.body.scrollTop="+document.body.scrollTop);

    console.log("onresize-- window.innerHeight="+window.innerHeight);

    console.log("onresize-- document.body.scrollHeight="+document.body.scrollHeight);

};

document.addEventListener('scroll', function (event) {

    console.log("document.body.scrollTop="+document.body.scrollTop);

    console.log("window.innerHeight="+window.innerHeight);

    console.log("document.body.scrollHeight="+document.body.scrollHeight);

    if (document.body.scrollHeight == 

        document.body.scrollTop +        

        window.innerHeight) {

        

    }

             var d = document.getElementById("div1");

var topPos = d.offsetTop;

console.log("topPos="+topPos);

});

    </script>

    

</body>


vivekmras.webhostingbuilders.com

One

Page Footer