Sikander
Sikander

Reputation: 2835

Jquery : Increase animation speed during animation

i am animating a div on click event what i want is increase speed of animation after every 0.2 seconds this is what i'm doing now

 <div class='col-md-6 col-sm-6 col-xs-12 animatediv' >
      <img src='images/camera.png' alt='camera'  class="camera">
      <p id='cameras' class='text-danger pull-right'>
      interested ? Read more
    </p>
</div>

Jquery

$(document).ready(function (){
    $('#cameras').click(function(){
         $(".animatediv").animate({'position':'relative','left':'700px'}, 2000, function(){
            window.location.replace("http://www.google.com");
        });
     });
});

now it animates whole div but i want i want to vary speed as mentioned above , Please help

Upvotes: 1

Views: 836

Answers (2)

bngk
bngk

Reputation: 59

Easings may help you to vary the speed during animation. Check out the link below for an example.

JQuery animation: Is it possible to change speed during the animation?

Upvotes: 0

Arun Sharma
Arun Sharma

Reputation: 1329

Jquery animate is used as .animate( properties [, duration ] [, easing ] [, complete ] )

You can reduce duration (in milliseconds) to make it appear faster( which is 2000 is your case)

Reduce it to 500 or less. Or you can use 'fast' in place of 2000

Upvotes: 1

Related Questions