JQ implements animation navigation example code
1. Accordion navigation can be used on both mobile and PC terminals
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css"> *{ list-style: none; padding: 0; margin: 0; } ul{ display: none; } h3{ background-color: blue; width: 100px; height: 30px; text-align: center; line-height: 30px; border: 1px solid chartreuse; margin: 0 auto; } ul>li{ background-color: chartreuse; width: 100px; height: 30px; text-align: center; line-height: 30px; border: 1px solid red; margin: 0 auto; }</style> <script src="../js/jquery-3.1.1.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript">// 通过jq的滑入滑出动画可作出手风琴式的导航栏$(document).ready(function(){//jq准备函数$("h3").on("click",function(){ $("h3").next().slideUp();//当前元素之下的节点$(this).next().stop(true).slideToggle();//使用间歇 }) })</script> </head> <body> <h3>语文</h3> <ul> <li>语文1</li> <li>语文2</li> <li>语文3</li> <li>语文4</li> </ul> <h3>数学</h3> <ul> <li>数学1</li> <li>数学2</li> <li>数学3</li> </ul> <h3>英语</h3> <ul> <li>英语1</li> <li>英语2</li> <li>英语3</li> </ul> <h3>地理</h3> <ul> <li>地理1</li> <li>地理2</li> <li>地理3</li> </ul> <h3>政治</h3> <ul> <li>政治1</li> <li>政治2</li> <li>政治3</li> </ul> </body> </html>
2. Drop-down navigation is suitable for PC terminals
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style type="text/css">ul{ list-style: none; margin-left: 35%; } ul li{float: left; width: 100px; height: 30px; background-color: deeppink; line-height: 30px; text-align: center; margin-left: 5px; } ul li>ul{ margin-left: -45px; margin-top: 5px; display: none; }</style> <script src="../js/jquery-3.1.1.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript">$(document).ready(function(){ $("#ul>li").hover(function(){//通过hover效果对该元素进行动画$(this).find("ul").stop().slideDown();//找到当前目标元素下的所有子节点下滑 },function(){ $(this).find("ul").stop().slideUp();//找到当前目标元素下的所有子节点上滑 }) })</script> </head> <body> <ul id="ul"> <li>去岁一别<ul> <li>一年</li> <li>两年</li> <li>三年</li> <li>四年</li> <li>五年</li> </ul> </li> <li>救赎问候<ul> <li>一次</li> <li>两次</li> <li>三次</li> <li>四次</li> <li>五次</li> </ul> </li> <li>深感愧疚<ul> <li>一句</li> <li>两句</li> <li>三句</li> <li>四句</li> <li>五句</li> </ul> </li> </ul> </body> </html>
There are more styles of navigation. Using C3 new attributes and animation, various styles of navigation will be realized.
The above is the detailed content of JQ implements animation navigation example code. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

CSS animation: How to achieve the flash effect of elements, specific code examples are needed. In web design, animation effects can sometimes bring a good user experience to the page. The glitter effect is a common animation effect that can make elements more eye-catching. The following will introduce how to use CSS to achieve the flash effect of elements. 1. Basic implementation of flash First, we need to use the animation property of CSS to achieve the flash effect. The value of the animation attribute needs to specify the animation name, animation execution time, and animation delay time
![Animation not working in PowerPoint [Fixed]](https://img.php.cn/upload/article/000/887/227/170831232982910.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
Are you trying to create a presentation but can't add animation? If animations are not working in PowerPoint on your Windows PC, then this article will help you. This is a common problem that many people complain about. For example, animations may stop working during presentations in Microsoft Teams or during screen recordings. In this guide, we will explore various troubleshooting techniques to help you fix animations not working in PowerPoint on Windows. Why aren't my PowerPoint animations working? We have noticed that some possible reasons that may cause the animation in PowerPoint not working issue on Windows are as follows: Due to personal

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 [

How to use Vue to implement typewriter animation special effects Typewriter animation is a common and eye-catching special effect that is often used in website titles, slogans and other text displays. In Vue, we can achieve typewriter animation effects by using Vue custom instructions. This article will introduce in detail how to use Vue to achieve this special effect and provide specific code examples. Step 1: Create a Vue project First, we need to create a Vue project. You can use VueCLI to quickly create a new Vue project, or manually

This website reported on January 26 that the domestic 3D animated film "Er Lang Shen: The Deep Sea Dragon" released a set of latest stills and officially announced that it will be released on July 13. It is understood that "Er Lang Shen: The Deep Sea Dragon" is produced by Mihuxing (Beijing) Animation Co., Ltd., Horgos Zhonghe Qiancheng Film Co., Ltd., Zhejiang Hengdian Film Co., Ltd., Zhejiang Gongying Film Co., Ltd., Chengdu The animated film produced by Tianhuo Technology Co., Ltd. and Huawen Image (Beijing) Film Co., Ltd. and directed by Wang Jun was originally scheduled to be released in mainland China on July 22, 2022. Synopsis of the plot of this site: After the Battle of the Conferred Gods, Jiang Ziya took the "Conferred Gods List" to divide the gods, and then the Conferred Gods List was sealed by the Heavenly Court under the deep sea of Kyushu Secret Realm. In fact, in addition to conferring divine positions, there are also many powerful evil spirits sealed in the Conferred Gods List.

The content that needs to be rewritten on this site is: 9 The content that needs to be rewritten is: Month The content that needs to be rewritten is: 23 The content that needs to be rewritten is: Daily News, the main line drama of the second season of the animated series "Arknights" "Arknights: Winter Hidden Return" has announced its final release. The content that needs to be rewritten is: PV. The content that needs to be rewritten is: 10. The content that needs to be rewritten is: 7. The content that needs to be rewritten is: 7 The content is: The content that needs to be rewritten is: 00:23 The content that needs to be rewritten is: Officially launched, click here to enter the official website of the theme. The content that needs to be re-written is: This site has noticed that "Arknights: Winter Hidden Return" is the sequel to "Arknights: Prelude to Dawn". The plot summary is as follows: In order to prevent the infected, a group of

According to news from this site, Miyazaki Hayao's animated film "Porco Rosso" has announced that it will extend the release date to January 16, 2024. This site previously reported that "Porco Rosso" has been launched in the National Art Federation Special Line Cinema on November 17, with a cumulative box office of over 2,000 10,000, with a Douban score of 8.6, and 85.8% of 4 and 5 star reviews. "Porco Rosso" was produced by Studio Ghibli and directed by Hayao Miyazaki. Moriyama Moriyama, Tokiko Kato, Otsuka Akio, Okamura Akemi and others participated in the dubbing. It was originally released in Japan in 1992. The film is adapted from Hayao Miyazaki's comic book "The Age of Airships" and tells the story of the Italian Air Force's ace pilot Pollock Rosen who was magically turned into a pig. After that, he became a bounty hunter, fighting against air robbers and protecting those around him. Plot synopsis: Rosen is a soldier in World War I

The final trailer for Netflix's claymation film "Chicken Run 2" has been released. The film is expected to be released on December 15. This site noticed that the trailer for "Chicken Run 2" shows Chicken Loki and King Kong. Jay launches an operation to find his daughter Molly. Molly is taken away by a truck at FunLand Farm, and Rocky and Ginger risk their lives to retrieve their daughter. The film is directed by Sam Fehr and stars Sandy Way Newton, Zachary Levi, Bella Ramsey, Imelda Staunton and David Bradley. It is understood that "Chicken Run 2" is the sequel to "Chicken Run" after more than 20 years. The first work was released in China on January 2, 2001. It tells the story of a group of chickens who face the fate of being turned into chicken pies in a chicken factory.
