| 214-564-5316 | | Thursday, May 17, 2012 |
|
Dynamic animation: fly in and shake screen
Refresh the page to see it again. The trigger for any javascript (like the fly in animation and the screen shake code which uses the moveBy() function) has to be "onSomething" like onClick, onLoad, onUnload, etc. This is called the "event handler". We'll set the javascript functions to be triggered when the page finishes loading (the body onLoad statement). The trick is to get the page shaking javascript to be timed correctly. When using more than one event in the event handler the browser loads the last one first. So, lets say your function to shake the page is called "shake(n)" where n is the length of time the page shakes. The body tag that loads the dynamic FP fly in function and the shake function might look like this: This simply tells the browser to wait 550 milliseconds after page load before running the function "shake(1)" |
Texas Web Developers is a premiere website designer in the Dallas, Texas Web Designers community on BodyModified.com. |