<SCRIPT type="text/javascript"
src="http://code.jquery.com/jquery-latest.js"></SCRIPT>
Code language: HTML, XML (xml)
For all the demos, we will use a sample DIV tag for animating. Following is the div code and its stylesheet. <style type="text/css">
#content {
background-color:#ffaa00;
width:300px;
height:30px;
padding:3px;
}
</style>
<input type="button" id="animate" value="Animate"/>
<div id="content">Animate Height</div>
Code language: HTML, XML (xml)
$("#animate").click(function() {
$("#content").animate(
{"height": "80px"},
"fast");
});
Code language: JavaScript (javascript)
Demo 1: $("#animate").click(function() {
$("#content").animate(
{"width": "350px"},
"fast");
});
Code language: JavaScript (javascript)
Demo 2: $("#animate").click(function() {
$("#content").animate(
{"opacity": "0.15"},
"slow");
});
Code language: JavaScript (javascript)
Demo 3: <STYLE>
#content {
background-color:#6688ff;
position:absolute;
width:100px;
height:100px;
padding:3px;
margin-top:5px;
left: 100px;
}
</STYLE>
<input type="button" id="left" value="Left"/>
<input type="button" id="right" value="Right"/>
<div id="content">Move</div>
Code language: HTML, XML (xml)
$("#right").click(function() {
$("#content").animate(
{"left": "+=50px"},
"slow");
});
$("#left").click(function() {
$("#content").animate(
{"left": "-=50px"},
"slow");
});
Code language: JavaScript (javascript)
Demo 4: $("#animate").click(function() {
$("#content").animate(
{"height": "100px", "width": "250px"},
"slow", function(){
$(this).html("Animation Completed");
});
});
Code language: JavaScript (javascript)
Demo 5: $("#animate").click(function() {
$("#content").animate(
{"height": "100px", "width": "250px"},
"slow", );
});
Code language: JavaScript (javascript)
Example 2: Queuing the animations. $("#animate").click(function() {
$("#content")
.animate({"height": "100px"}, 500)
.animate({"width": "250px"}, 500);
});
Code language: JavaScript (javascript)
Demo 6: queue
parameter to disable queuing. In following example we have set parameter queue
to false
. The code is exactly same as demo 6, only change we added is queue = false. Also note that queue parameter is added with second argument. $("#animate").click(function() {
$("#content")
.animate({"height": "100px"}, {"queue": false, "duration": 500})
.animate({"width": "250px"}, 500);
});
Code language: JavaScript (javascript)
Demo 7: Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
Ah... I guess you will explain how internally animate & fx function deals with timer queue!
nice one, but I have something to ask if jquery work in a fancybox...?.
Great tutorial. Thanks!
Love the tutorial...thanks and great work
Really nice one. great work. thanks buddy. try to keep on update
tohh...his is great
This is really great. Thanks for the compilation!
prikitiuw... great tutorial.
thx plen
I lıve jQuery.I love jQuery animation.=)
Awesome tutorial. Thanks lots. God bless you!