| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|---|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml">
|
|---|
| 3 | <head>
|
|---|
| 4 | <title>Testing jQuery's animation onComplete</title>
|
|---|
| 5 | <script src="/fr/new/js/jquery-1.2.1.min.js"></script>
|
|---|
| 6 | <script>
|
|---|
| 7 | jQuery(function($){
|
|---|
| 8 | divHeight = $("div").height();
|
|---|
| 9 | numberOfTries = 5;
|
|---|
| 10 | $("#animator").one('click', function(){
|
|---|
| 11 | $("div").css({
|
|---|
| 12 | overflow: 'hidden',
|
|---|
| 13 | height: '0px',
|
|---|
| 14 | visibility: 'visible'
|
|---|
| 15 | }).animate(
|
|---|
| 16 | {height:divHeight},
|
|---|
| 17 | 1500,
|
|---|
| 18 | (function() {
|
|---|
| 19 | alert(numberOfTries--);
|
|---|
| 20 | if(numberOfTries) {
|
|---|
| 21 | badFunc();
|
|---|
| 22 | }
|
|---|
| 23 | })
|
|---|
| 24 | );
|
|---|
| 25 | });
|
|---|
| 26 | });
|
|---|
| 27 | </script>
|
|---|
| 28 | </head>
|
|---|
| 29 | <body>
|
|---|
| 30 | <a id="animator" style="text-decoration: underline; color: blue; cursor: pointer;">I SHOW YOU SECRETS</a>
|
|---|
| 31 | <p>secret stuff below</p>
|
|---|
| 32 | <div style="visibility: hidden;">I am the secret information<br />you are dying to get your hands on!<br />using Firefox? you may have to restart your browser now<br />look at the code to see why--badFunc() is being repeatedly called! <br />the alert() is needed to keep your CPU utilization down!</div>
|
|---|
| 33 | </body>
|
|---|
| 34 | </html> |
|---|