Using jQuery to Implement Animations in ASP.NET [con't]
Implementing Animations Using jQuery
You can use jQuery to animate a
<HTML> element easily by using the
.animate() method and passing the necessary parameters to it. In this example, we'll use the
.animate() method in jQuery to demonstrate text animation. To implement a demo application for this example, follow these steps:
- Create a new ASP.NET project in Visual Studio 2008 or Visual Studio 2010.
- Save it with a name.
- Open the
- Drag and drop the jQuery library file onto your WebForm.
This will create the following reference:
- Take two Button controls: one for starting animation and the other for resetting it. Here is what the markup code for the Button controls would look like:
- Create a
<div>and place some text inside it as shown below:
- In the
document.ready()function, write code as shown below to animate the text inside the
<div>you just created:
And, you are done! When you execute the application, you'll see two button controls and the text "Welcome to jQuery!" displayed in the browser. When you click on the Animate button, the text is enlarged and animated. On click of the Reset button, the same text is reset to its original size and style.
The Complete Source Code
In this article, I discussed animations using jQuery. In the future articles, I will take a look at the other powerful features of the jQuery library.
Original: June 30, 2010