Animate image in jQuery

Animate image using jQuery can be performed via a .animate() method. In this article, we have discussed how to change the size of image on button click in jQuery.

jQuery provides several methods to implement different kinds of effects in a simple HTML page. jQuery is basically a JavaScript library that simplifies the JavaScript work.

Here we takes a small example, that will resize the image on click. If you see the code carefully, you'll find how crucial is the .animate() method is, in jQuery.

It helps you to change the size of an images on click. Here is the examples of an image animations that changes its width and height attributes with jQuery animate function.

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Animate Div in Jquery</title>
div {
background-color: #abc;
width: 400px;
border: 1px solid red;
<script src=""></script>

$(document).ready(function () {
var large={width: "185px",height: "250px"};
var small={width: "400px",height: "232px"};
var count=1; 
$("#image").click(function () { 
count = 1-count;
<div>Click Image to change the image Size.</br>
<img src="bridal.jpg" id="image" /></div>
Share on Google+Share on Google+

Animate image in jQuery

Posted on: December 29, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Animate image in jQuery  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image