There are several ways to display and hide an action element.
For example:
- Change style display to none
- Set position height to 0
- Set the transparency to 0
Can achieve this, and it provides a way to deal with jquery. Show/hide, Sildedown/sildeup, Fadein/fadeout. In addition, toggle, Sildetoggle, and Fadetoggle switching methods are introduced.
The difference between toggle, Sildetoggle, and Fadetoggle:
- Toggle: Toggle Display and hide effects
- Sildetoggle: Toggle roll up and down roll effect
- Fadetoggle: Toggle Fade Effect
There are, of course, more differences in the details:
Toggle and slidetoggle Detail differences:
- Toggle: The dynamic effect is from right to left. Horizontal motion, toggle the visibility of all matching elements through display
- Slidetoggle: Dynamic effect from bottom to top. Vertical action, Slidetoggle toggles the visibility of all matching elements through a height change
Fadetoggle method
The Fadetoggle () method toggles between the FadeIn () and the FadeOut () methods.
The elements are faded out, and fadetoggle () displays them using the fade-in effect.
The elements are in-fade, and fadetoggle () displays them using the fade effect.
Note: Hidden elements are not fully displayed (no longer affect the layout of the page)
Comparison of toggle with Slidetoggle and Fadetoggle in jquery