Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to add an iscroll on a page for smooth scrolling?

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 572
    Comment on it

    We can simply add an iscroll in our page so that the scrolling becomes smooth in iphone. You simply need to download the js file and inject it into your HTML.

    Here is an example code:

        <html>
        <header>
        <h1 class="ui-title">Terms of use</h1>
            <a class="interface header-panel ui-link" href="javascript:;" ng-click="leftMenu()"></a>
        </header>
        <body>
        <script src="js/iscroll.js"></script>
        <script src="js/angular.min.js"></script>
        <div id="wrapper">
            <section class="midArea">
                <div class="detail_text detail_text3">
                    <p>
                        Abcd Service Terms of Use
                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
       Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
        </p>
    </div>
    </section>
    </div>
        </body>
        </html>
    

    I am using iscroll with AngularJS. Also in this code ui router is used. You can implement the same logic in a simpler way also. Now you need to add few lines into your controller.

    Here is the code:

    mainApp.controller( "termscontroller", function( $scope, $http, $state ) {
        var myScroll;
        myScroll = new iScroll('wrapper');
    });
    
        .state('home.terms', {
                    url: '/terms',
                    templateUrl: 'home-terms.html',
                    controller: 'termscontroller'
                } )
    

    iScroll must be applied to the wrapper of the scrolling area.

    Note:

    The iscroll works properly only when the data is hard coded. It gives issues when the data comes from the server on the page.

    For more information on iscroll and downloading its js file you can refer to the following link:-

    https://github.com/cubiq/iscroll

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: