jQuery offers a ridiculously simple interface for creating a variety of fantastic effects. We may utilize jQuery methods to quickly apply common effects with minimal preparation. This lesson walks you through the essential jQuery methods for creating visual effects.
Visible elements and those that are hidden
The procedures for displaying and hiding elements are very straightforward: show() displays the elements in a wrapped set, while hide() hides them.
The show() method [selector] has the following simple syntax.
show(speed, [callback]); show(speed, [callback]); show(speed, [callback
speed is a string that represents one of three predefined animation speeds ("slow," "normal," or "rapid") or the number of milliseconds to perform the animation (e.g., 1000).
This optional argument represents a function executed once for each element animated against after the animation completes.
The hide() function [selector] has the following simple syntax.
hide(speed, [callback]); hide(speed, [callback]); hide(speed, [callback
speed is a string that represents one of three predefined animation speeds ("slow," "normal," or "rapid") or the number of milliseconds to perform the animation (e.g., 1000).
This optional argument represents a function that will be executed once for each element animated against after the animation completes.
Consider the HTML file below, which includes some JQuery scripting.
Switching Between Elements
Toggling the display state of elements between shown and concealed is possible using jQuery. If the element was initially visible, it would be hidden; previously, it would be revealed.
toggle([speed][, callback]); [selector]..toggle([speed][, callback]);
speed is a string that represents one of three predefined animation speeds ("slow," "normal," or "rapid") or the number of milliseconds to perform the animation (e.g., 1000).
This optional argument represents a function that will be executed once for each element animated against after the animation completes.
Any element, such as a simple div> containing an image, can be animated.
|