Saturday, 4 July 2015

Jquery mobile's ONSCROLL function

<!DOCTYPE html>
<html>
<head>
    <!-- Include meta tag to ensure proper rendering and touch zooming -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Include jQuery Mobile stylesheets -->
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <!-- Include the jQuery library -->
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <!-- Include the jQuery Mobile library -->
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    <script>
 
        function pagetwonav() {
            window.location.href = "#pagetwo";
            var name = document.getElementById('naam').value;
            document.getElementById('showName').innerHTML=name
        }
 
        $(document).on("pagecreate","#pageone",function(){
            $("li").on("swipe", function () {
                $(this).hide();
            });
            $(document).on("scrollstart", function () {
                alert("you started scroling!!");
            });
        });
       
       
 
    </script>
</head>
<body>
 
    <div data-role="page" id="pageone">
        <div data-role="header">
            <h1>Welcome To My Homepage</h1>
        </div>
 
        <div data-role="main" class="ui-content">
            <p>Welcome!</p>
            <a href="#pagetwo" data-transition="slide"> Navigate to page two</a>
            <input type="text" name="name" placeholder="Your Name" id="naam">
            <input type="button" value="Go" id="button" onclick="pagetwonav()">
        </div>
        <ul data-role="listview" >
            <li>tea</li>
            <li>coffee</li>
            <li>tea</li>
            <li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li><li>tea</li>
<li>coffee</li>
            </ul>
 
        <div data-role="footer" data-position="fixed" style="background-color:#ff0000">
            <h1>&copy; Codeblix</h1>
        </div>
    </ol>
 
    <div data-role="page" id="pagetwo">
        <div data-role="header">
            <h1>Welcome </h1>
        </div>
 
        <div data-role="main" class="ui-content">
            <p>Welcome <div id="showName"></div></p>
 
        </div>
 
        <div data-role="footer" data-position="fixed">
            <h1>Footer Text for page 2</h1>
        </div>
    </div>
 
 
</body>
    </html>

No comments:

Post a Comment