Home  >  Article  >  Web Front-end  >  The difference between toggle and slideToggle in jquery

The difference between toggle and slideToggle in jquery

巴扎黑
巴扎黑Original
2017-06-29 11:48:521166browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn