Built-in animation functions show () and hide ()
Call the show () function to set the display attribute of the element to none and hide the element.
Call the hide () function to set the display style of the element to the original value and re-display the element.
Tip:
When this method is used, the width, height, and transparency of the element change simultaneously. You can pass the parameters "fast", "normal", "slow" to this method, or enter a number (in milliseconds) to control the speed at which elements disappear/appear.
Example program:
Jquery test<Script type = "text/javascript" src = "jquery. js"> </script>You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. <Script type = "text/javascript"> $ ("div. one "). bind ("mouseover", function () {$ (this ). next ("div. two "). show ("slow") ;}; $ ("div. one "). bind ("mouseout", function () {$ (this ). next ("div. two "). hide ("slow") ;}) </script>
FadeIn () and fadeOut () Methods
FadeIn () indicates fade in, and fadeOut () indicates fade out. This function controls the hiding and appearance of elements by controlling the transparency of elements. You can also control the speed by passing parameters.
Jquery test<Script type = "text/javascript" src = "jquery. js"> </script>You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. <Script type = "text/javascript"> $ ("div. one "). bind ("mouseover", function () {$ (this ). next ("div. two "). fadeIn ("slow") ;}; $ ("div. one "). bind ("mouseout", function () {$ (this ). next ("div. two "). fadeOut ("slow") ;}) </script>
SlideDown () and slideUP () Methods
SlideDown () indicates that the elements appear from top to bottom. slideUp () indicates that the elements slide from bottom to top and disappear, much like the shutter we encounter in our life. This function controls the height of an element to disappear and appear.
Jquery test<Script type = "text/javascript" src = "jquery. js"> </script>You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. You have established a broadband connection. If you want to continue using the broadband access function, do not close this window. If you want to disconnect, click
<下线>
Button. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. This clock is for reference only and is not used as the billing basis. <Script type = "text/javascript"> $ ("div. one "). bind ("mouseover", function () {$ (this ). next ("div. two "). slideDown ("slow") ;}; $ ("div. one "). bind ("mouseout", function () {$ (this ). next ("div. two "). slideUp ("slow") ;}) </script>
Custom Animation functions (paras, speed, callback );
The three parameters are: The ing of the target style attribute, the speed parameter (optional), and the action executed when the animation is completed (optional)
Custom simple animation:
Jquery test<Script type = "text/javascript" src = "jquery. js"> </script>Online Payment Portal connection <script type = "text/javascript"> $ ("div. one "). click (function () {$ (this ). animate ({left :( $ (document. body ). width ()-$ (this ). width () }, 3000) ;}); </script>
The code above demonstrates that when a user clicks a div, The div will be moved from the left side of the page to the right side.
Execute multiple animations at the same time:
In fact, more than one attribute is set in the first parameter, so that multiple attributes of the element change at the same time.
Jquery test<Script type = "text/javascript" src = "jquery. js"> </script>Online Payment Portal connection <script type = "text/javascript"> $ ("div. one "). click (function () {$ (this ). animate ({left :( $ (document. body ). width ()-$ (this ). width ()}, 3000 ). animations ({height: "500px"}, 3000 ). animate ({opacity: "0.5" }, 3000) ;}); </script>
The demo result of the code above is the same as the final result of the previous example, but the changes to the position, height, and transparency attributes of the div do not occur at the same time, but change sequentially, in addition, each action takes 3000 milliseconds, and the total time is 9000 milliseconds.
Animation callback function:
Jquery test<Script type = "text/javascript" src = "jquery. js"> </script>Online Payment Portal connection <script type = "text/javascript"> function fun () {var $ content = $ ("
- Test one
- Test two
- Test three
"); Var $ target = $ (" div. one "); $ target. append ($ content ). addClass ("two") ;}$ ("div. one "). click (function () {$ (this ). animate ({left :( $ (document. body ). width ()-$ (this ). width ()}, 3000 ). animations ({height: "500px"}, 3000 ). animate ({opacity: "0.5"}, 3000, function () {fun () ;}); </script>
The function of returning an animation is to insert the function into the animation queue, rather than executing it at the beginning of the animation.
The fun function in the above code is executed after the third animation in the animation queue is executed.