An article to help you understand jQuery animation

An article to help you understand jQuery animation
jQuery provides some default animations to control the display and hiding of elements: show() hide()
	Control the transparency of an element fadeIn() fadeOut()
	Control the height of an element slideUp() slideDown()
	Custom animation animate()

1. Control the display and hiding of elements show() hide()

grammar:

 $("selector").show([speed],[callback]);

Reference description:

Parameter 1 : speed, optional, for example: 1000 milliseconds, 1 second, fast, slow, normal

Parameter 2 : callback function, optional function to be executed after the show or hide function is executed

$(function () {
			$(".nav-ul li").on({"mouseover":function () {
					$(this).css("background","pink")
				},"mouseout":function () {
					$(this).css("background","#ff2832")
				}});
			$(".menu-btn").hover(function () {
				$(this).next().show("fast")
			},function () {
				$(this).next().hide("slow")
			})
		})

2. Control the transparency of elements fadeIn() fadeOut()

grammar:

    $("selector").fadeIn([speed],[callback]);
    $("selector").fadeOut([speed],[callback]);

Reference description:

Parameter 1 : speed, optional, default is 0, for example: 1000 milliseconds, etc., 1 second fast slow normal

Parameter 2 : callback function, optional. The function to be executed after fadeIn or fadeOut is executed.

$(function () {
		$("input[name='fadein_btn']").click(function () {
			$("img:eq(0)").fadeIn(500,function () {
				alert("fade in successfully")
			})
		})
		$("input[name='fadeout_btn']").click(function () {
			$("img:eq(0)").fadeOut(1000,function () {
				alert("fade out successfully")
			})
		})
	})

3: Control the height of the element slideUp() slideDown()

slideDown() makes the element gradually extend and display

slideUp() makes the element gradually shorten until it is hidden

grammar:

    $("selector").slideUp([speed],[callback]);
    $("selector").slideDown([speed],[callback]);

Reference description:

Parameter 1: speed, optional, default is 0, for example: 1000 milliseconds, etc., 1 second fast slow normal

Parameter 2: callback function, optional. The function to be executed after slideUp or slideDown is executed.

Summarize

This article ends here. I hope it can be helpful to you. I also hope that you can pay more attention to more content on 123WORDPRESS.COM!

You may also be interested in:
  • jQuery implements ad display and hide animation
  • jQuery animation operation complete example analysis
  • JQuery animate animation application example
  • Detailed explanation of JQuery basic animation operations
  • [jQuery] Detailed explanation of events and animations

<<:  Use CSS3 background control properties + color transition to achieve gradient effect

>>:  Have you really learned MySQL connection query?

Recommend

How to convert mysql bin-log log files to sql files

View mysqlbinlog version mysqlbinlog -V [--versio...

MySQL database aggregate query and union query operations

Table of contents 1. Insert the queried results 2...

Introduction and installation of MySQL Shell

Table of contents 01 ReplicaSet Architecture 02 I...

How to deploy Vue project under nginx

Today I will use the server nginx, and I also nee...

How to optimize images to improve website performance

Table of contents Overview What is Image Compress...

Vue implements login jump

This article example shares the specific code of ...

In-depth reading and practice records of conditional types in TypeScript

Table of contents Using conditional types in gene...

Practical basic Linux sed command example code

The Linux stream editor is a useful way to run sc...

js realizes the magnifying glass function of shopping website

This article shares the specific code of js to re...

Web Design: Script Materials Reconstruct User Experience

<br />Original text: http://blog.rexsong.com...

How to add a certificate to docker

1. Upgrade process: sudo apt-get update Problems ...

Ubuntu Server 16.04 MySQL 8.0 installation and configuration graphic tutorial

Ubuntu Server 16.04 MySQL 8.0 installation and co...

How to install vim editor in Linux (Ubuntu 18.04)

You can go to the Ubuntu official website to down...