Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Example of parallax

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 432
    Comment on it

    Hello Readers !
    Here is an example of parallax with simple script and it is also compatible with internet explorer.

    Script :-

    1. <script type="text/javascript">
    2. $(document).ready(function() {
    3. $(window).bind('scroll',function(){
    4. parallax();
    5. })
    6. })
    7. function parallax(){
    8. var scrollposition=$(window).scrollTop();
    9. $('.ground').css('top',(0 - (scrollposition * .1))+'px')
    10. $('.box').css('top',(0 + (scrollposition * 1.2))+'px')
    11. }
    12. </script>

    html

    1. <div class="main">
    2. <div class="ground" id="base"></div>
    3. <div class="box"></div>
    4. </div>

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: