Home > Article > Web Front-end > The difference between toggle and slideToggle in jquery
jQueryThe
toggle and slideToggle methods can both display and hide an element. Powerful~
The difference is:
toggle: the dynamic effect is from right to left. Lateral movements.
slideToggle: Dynamic effect from bottom to top. Vertical action.
So, for example, if you want to achieve a dynamic effect of a tree shrinking from bottom to top, just use slideToggle.
In addition, there are some parameters for toggle and slideToggle that can be set. For details, just look at jQuery’s API~
Usage of toggle:
< ;SCRIPT src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">
width:100px; height:100px; background-color:red;" id= "z">
Usage of slideToggle:
value="下拉" />
The above is the detailed content of The difference between toggle and slideToggle in jquery. For more information, please follow other related articles on the PHP Chinese website!