Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Start an infinite animation effect on page load using jQuery

    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 887
    Comment on it

    Hii,
    When we talk about adding animation effect in our web page then  css is one the best option we use along with any of the programming laungage such as javascript,jQuery etc to give dynamic animation effects.
    Using animation effect in a webpage helps us to make the web page attractive and beautiful.
    Here's is an example of an animation effect using jQuery in which i have created an infinite animation effect which will start as the page will load and stop only if you close that webpage.

    Syntax:

    1. animate(properties[, duration][, easing][, callback])
    2. animate(properties[, options])

    Example: 

    CSS:

    .boxOne{width:500px;height: 500px;display: block;position: relative;border: 1px solid black;margin: 20px auto;}
    .boxTwo{display: block;width: 20px;height: 20px;position: absolute;background-color: #2196F3;border-radius:100%;}

    HTML:

    <div class="boxOne">
       <div class="boxTwo"></div>
       </div>

    jQuery:

    (function animation() {
       		var options = {
    	      duration: 500,
    	      easing: 'linear'
       };
    
       $('.boxOne')
          .find('.boxTwo')
          .animate({
                left: 500,
                top: 480
             },
             options
          )
          .animate({
                left: 0,
             },
             options
          )
          .animate({
                left: 480,
                top: 0,
             },
             options
          )
          .animate({
                left: 0,
             },
             $.extend(true, {}, options, {
                complete: function() {
                   animation();
                }
             })
          );
    })();

    Note:  Must include this link in your file

    <script src="http://code.jquery.com/jquery-git1.js"></script>
     

 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: