Jquery Animation

Advertisements

Prev Tutorial Next Tutorial

Animation

Jquery animation() are used to create custom animation on web page.

Syntax

$(selector).animate({params},speed,callback);
  • Here speed parameter is optional, speed parameter specifies the speed of the hiding/showing, and can take values: "slow", "fast", or milliseconds.
  • callback parameter is optional, callback parameter is a function to be executed after the hide() or show() method completes.

Example of animation in jQuery

<!DOCTYPE html>
<html>
<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $("div").animate({left: '450px'});
    });
});
</script>
</head>
<body>

<button>Start Animation</button>

<div style="background:#3399FF;height:100px;width:106px;position:absolute;"></div>

</body>
</html>

Output

Note: you can format above code like you want, including line breaks. JQuery is not very strict on the syntax.

Syntax

<script>
$(document).ready(function(){
    $("button").click(function(){
        $("#para").css("color", "blue")
		.slideUp(2000)
		.slideDown(2000);
    });
});
</script>

Prev Tutorial Next Tutorial

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements