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

The difference between toggle and slideToggle in jquery

巴扎黑
Release: 2017-06-29 11:48:52
Original
1306 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template