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.

Animate image 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>