<abbr id="tfzvi"></abbr>
      <track id="tfzvi"><th id="tfzvi"></th></track>
    <rp id="tfzvi"><video id="tfzvi"><object id="tfzvi"></object></video></rp>
  • <span id="tfzvi"><video id="tfzvi"></video></span>
    \n\t\t

    \n\t\t\t

    歡迎xxx登錄,祝您購物愉快<\/p>\n\t\t<\/p>\n\t\t\n\t\t

    国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

    Home Web Front-end JS Tutorial How to implement animation effects and callback functions

    How to implement animation effects and callback functions

    Jun 15, 2018 am 11:37 AM
    css3 jquery animation Callback

    Below I will share with you an example of CSS3 combined with jQuery to achieve animation effects and callback functions. It has a good reference value and I hope it will be helpful to everyone.

    In writing the final project, a friend proposed an idea, a special effect to welcome the user when the user logs in successfully, that is, the welcome user information rises from the bottom to the page, and then returns to the bottom.

    The problem he encountered was: The prompt information can come out from the bottom, but after it comes out, it cannot go down.

    After hearing this, I thought about it and thought of using a callback function to solve this bug, and then simulated entering the homepage (i.e. refreshing the page) when the login is successful, the welcome message pops up and disappears, and I wrote an animation effect similar to this. For reference only:

    Rendering:

    ##The code is as follows:

    <!DOCTYPE html>
    <html>
    	<head>
    		<meta charset="utf-8" />
    		<title>歡迎動(dòng)畫</title>
    		<style>
    		 	*{margin:0;padding:0;}
    		 	p {
    		 		margin:0 auto;
    		 		width:100%;
    		 		height:700px;
    		 		overflow:hidden;
    		 		position:relative;
    		 	}			
    		 	p {
    				width:220px;
    				height:40px;
    				line-height:40px;
    				text-align:center;
    				display:block;color:#900;
    				background:#ccc;
    				position:absolute;
    				bottom:-40px;
    				left:500px;
    		 	}
    		</style>
    	</head>
    	<body>
    		<p>
    			<p>歡迎xxx登錄,祝您購物愉快</p>
    		</p>
    		
    		<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
    		<script type="text/javascript">
    			// 函數(shù)入口
    			$(function(){
    			 show();
    			});
    			// 動(dòng)畫函數(shù)
    			function show(){
    				// 獲取p盒子的高度
    			 	var p = $("p").height(); 
    			 	$(function(){
    			 		// 動(dòng)畫函數(shù)
    			 	$("p").animate({"bottom":p*9},3000,function(){
    			 		// 回調(diào)函數(shù)
    			  	$("p").animate({"bottom":-p},6000);
    			 	});
    			
    			 	});
    			}
    		</script>
    	</body>
    </html>

    Here we mainly use the animate animation property in css3, combined with jQuery to realize the time and direction of animation execution, and finally set the callback function to return the prompt information to the initial position.

    The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

    Related articles:

    How to use ES6 syntax in Node (detailed tutorial)

    How to configure Sass in vue scaffolding

    Use Nodejs to connect to mysql to implement basic operations

    How to implement HTML attribute binding in Angular4

    How to write the multiplication table using JS

    The above is the detailed content of How to implement animation effects and callback functions. For more information, please follow other related articles on the PHP Chinese website!

    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

    Hot AI Tools

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    How to use PUT request method in jQuery? How to use PUT request method in jQuery? Feb 28, 2024 pm 03:12 PM

    How to use PUT request method in jQuery? In jQuery, the method of sending a PUT request is similar to sending other types of requests, but you need to pay attention to some details and parameter settings. PUT requests are typically used to update resources, such as updating data in a database or updating files on the server. The following is a specific code example using the PUT request method in jQuery. First, make sure you include the jQuery library file, then you can send a PUT request via: $.ajax({u

    How to set up ppt animation to enter first and then exit How to set up ppt animation to enter first and then exit Mar 20, 2024 am 09:30 AM

    We often use ppt in our daily work, so are you familiar with every operating function in ppt? For example: How to set animation effects in ppt, how to set switching effects, and what is the effect duration of each animation? Can each slide play automatically, enter and then exit the ppt animation, etc. In this issue, I will first share with you the specific steps of entering and then exiting the ppt animation. It is below. Friends, come and take a look. Look! 1. First, we open ppt on the computer, click outside the text box to select the text box (as shown in the red circle in the figure below). 2. Then, click [Animation] in the menu bar and select the [Erase] effect (as shown in the red circle in the figure). 3. Next, click [

    jQuery Tips: Quickly modify the text of all a tags on the page jQuery Tips: Quickly modify the text of all a tags on the page Feb 28, 2024 pm 09:06 PM

    Title: jQuery Tips: Quickly modify the text of all a tags on the page In web development, we often need to modify and operate elements on the page. When using jQuery, sometimes you need to modify the text content of all a tags in the page at once, which can save time and energy. The following will introduce how to use jQuery to quickly modify the text of all a tags on the page, and give specific code examples. First, we need to introduce the jQuery library file and ensure that the following code is introduced into the page: &lt

    Use jQuery to modify the text content of all a tags Use jQuery to modify the text content of all a tags Feb 28, 2024 pm 05:42 PM

    Title: Use jQuery to modify the text content of all a tags. jQuery is a popular JavaScript library that is widely used to handle DOM operations. In web development, we often encounter the need to modify the text content of the link tag (a tag) on ??the page. This article will explain how to use jQuery to achieve this goal, and provide specific code examples. First, we need to introduce the jQuery library into the page. Add the following code in the HTML file:

    Understand the role and application scenarios of eq in jQuery Understand the role and application scenarios of eq in jQuery Feb 28, 2024 pm 01:15 PM

    jQuery is a popular JavaScript library that is widely used to handle DOM manipulation and event handling in web pages. In jQuery, the eq() method is used to select elements at a specified index position. The specific usage and application scenarios are as follows. In jQuery, the eq() method selects the element at a specified index position. Index positions start counting from 0, i.e. the index of the first element is 0, the index of the second element is 1, and so on. The syntax of the eq() method is as follows: $("s

    Introduction to how to add new rows to a table using jQuery Introduction to how to add new rows to a table using jQuery Feb 29, 2024 am 08:12 AM

    jQuery is a popular JavaScript library widely used in web development. During web development, it is often necessary to dynamically add new rows to tables through JavaScript. This article will introduce how to use jQuery to add new rows to a table, and provide specific code examples. First, we need to introduce the jQuery library into the HTML page. The jQuery library can be introduced in the tag through the following code:

    How to use database callback functions in Golang? How to use database callback functions in Golang? Jun 03, 2024 pm 02:20 PM

    Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

    How to make animated thunderstorm in thunderstorm ppt How to make animated thunderstorm in thunderstorm ppt Mar 20, 2024 pm 02:41 PM

    Sometimes we encounter the need to add animation to a ppt. For example, if we want to make a thunderstorm ppt and add some animated thunderstorm effects to it, what should we do? Today, the editor will introduce to you how to make an animated thunderstorm in thunderstorm ppt. It is actually very simple, come and learn it! 1. First we open a PPT page, &quot;Insert&quot; - &quot;Shape&quot; - &quot;Basic Shape&quot; - &quot;Lightning Shape&quot;, as shown in the picture. 2. In the &quot;Fill and Line&quot; tab on the right, select &quot;Fill&quot;: white; &quot;Select&quot; &quot;Line&quot;: black, as shown in the figure. 3. Click &quot;Animation&quot; - &quot;Custom Animation&quot; - &quot;Add Effects&quot; - &quot;Emphasis&quot; - &quot;Subtle&quot; - &quot;Flickering&quot;,

    See all articles