Creating a jQuery plugin
This recipe will explain how you can create a simple jQuery plugin. The user will be able to enter two numbers and the plugin will count from the first number to the second number while animating just like how a stopwatch changes. We will call it Cash Counter. You will also be able to specify how fast or slow the animation runs.
Getting ready
Create a folder Recipe4
inside the Chapter9
directory.
How to do it...
Create a file named
index.html
insideRecipe4
folder. In this file, create two text boxes to enter starting and end numbers, anh1
element to display the number as it changes, and a button to initiate the process.<html> <head> <title>Cash Counter</title> <style type="text/css"> body{ font-family:"Trebuchet MS",verdana,arial;width:900px;margin:0 auto; } ul{ list-style:none;padding:10px; } label{ display:block;float:left;width:75px; } </style> </head> <body> <ul> ...