Home Web Front-end JS Tutorial How jQuery implements the effect of the mouse hover navigation underline sliding out

How jQuery implements the effect of the mouse hover navigation underline sliding out

Sep 30, 2017 am 11:23 AM
jquery Underline navigation

This article mainly introduces the jquery mouse hover navigation underline slide-out effect in detail. The menu underline appears when the mouse hovers and expands to both sides. It has certain reference value. Interested friends can refer to it.

The example in this article shares the specific code for the underline slide-out effect of jquery mouse hover navigation for your reference. The specific content is as follows


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>jquery鼠标悬停导航下划线滑出效果</title>

<style>

*{ margin:0; padding:0; list-style:none;}

img{ border:0;}

 

.header{ width:100%; background:#F5F5F5;}

.nav{ width:1000px; margin:0 auto; overflow:hidden;}

.nav ul li{ height:40px; line-height:40px; float:left; padding:10px 5px; margin:0px 5px;position:relative;}

.nav ul li a{ color:#666; font-family:&#39;Microsoft Yahei&#39;; font-size:14px; text-decoration:none;}

.nav ul li a:hover{ color:#000; text-decoration:none;}

.nav ul li span{ display:block; position:absolute; width:0px; height:0px; background:#1FAEFF; top:58px; left:50%;}

</style>

</head>

<body>

<p class="header">

<p class="nav">

<ul>

<li><a>首页</a><span></span></li>

<li><a>菜单导航</a><span></span></li>

<li><a>时间日期</a><span></span></li>

<li><a>焦点图</a><span></span></li>

<li><a>tab标签</a><span></span></li>

<li><a>jquery特效</a><span></span></li>

<li><a>相册代码</a><span></span></li>

<li><a>图片特效</a><span></span></li>

<li><a>名站特效</a><span></span></li>

</ul>

</p>

</p>

<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>

<script>

$(function(){

$(&#39;.nav li&#39;).hover(function(){

$(&#39;span&#39;,this).stop().css(&#39;height&#39;,&#39;2px&#39;);

$(&#39;span&#39;,this).animate({

left:&#39;0&#39;,

width:&#39;100%&#39;,

right:&#39;0&#39;

},200);

},function(){

$(&#39;span&#39;,this).stop().animate({

left:&#39;50%&#39;,

width:&#39;0&#39;

},200);

});

});

</script>

</body>

</html>

Copy after login

The above is the detailed content of How jQuery implements the effect of the mouse hover navigation underline sliding out. 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

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.

Undress AI Tool

Undress AI Tool

Undress images for free

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)

Why can't the blank underline in the wps document be printed? How should I underline it? Why can't the blank underline in the wps document be printed? How should I underline it? Mar 20, 2024 am 09:40 AM

When entering text in Word, sometimes some positions need to be underlined to explain or emphasize. So why can't the blank underline in the WPS document be printed? How should I underline? The editor will introduce it to you in detail below, let’s take a look. In WPS documents, you can underline the blank spaces, as shown in the figure. How to do it? Please read below for detailed operations. Take the document in the picture as an example to demonstrate how to underline the blank space. Place the cursor on the right side of the colon of &quot;Name&quot; in the picture, and press the space bar on the keyboard. In order to facilitate the demonstration, I have increased the font size, as shown below: 2. Then, after the cursor reaches the set position, click and hold without letting go, and move to Drag on the left to the side of the colon, as shown in the picture: 3. Then click the &quot;underline&quot; icon, as indicated by the arrow in the picture.

How to type underline in Excel How to type underline in Excel Mar 20, 2024 am 08:37 AM

With the progress of society, technology has also developed rapidly, and electronic equipment has become a standard configuration in today's office. There are various types of office software today. Excel is still a commonly used operation in office software. We sometimes set settings in tables. In order to highlight these contents, we will choose different color fonts or deepen the fonts, and sometimes underline them for emphasis. The fonts are easy to set, but not everyone knows how to add underlines. Editor Today I will teach my novice friends how to underline in excel. 1. Open Excel and type a few words, as shown in the picture below. 2. Select the text, right-click and select &quot;Format Cells&quot; option, as shown in the figure below. 3. Find “single underline” and

Detailed explanation of jQuery reference methods: Quick start guide Detailed explanation of jQuery reference methods: Quick start guide Feb 27, 2024 pm 06:45 PM

Detailed explanation of jQuery reference method: Quick start guide jQuery is a popular JavaScript library that is widely used in website development. It simplifies JavaScript programming and provides developers with rich functions and features. This article will introduce jQuery's reference method in detail and provide specific code examples to help readers get started quickly. Introducing jQuery First, we need to introduce the jQuery library into the HTML file. It can be introduced through a CDN link or downloaded

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 remove the height attribute of an element with jQuery? How to remove the height attribute of an element with jQuery? Feb 28, 2024 am 08:39 AM

How to remove the height attribute of an element with jQuery? In front-end development, we often encounter the need to manipulate the height attributes of elements. Sometimes, we may need to dynamically change the height of an element, and sometimes we need to remove the height attribute of an element. This article will introduce how to use jQuery to remove the height attribute of an element and provide specific code examples. Before using jQuery to operate the height attribute, we first need to understand the height attribute in CSS. The height attribute is used to set the height of an element

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

Amap launches upgraded version of driving ETA service: real-time analysis of current road conditions and more accurate estimated arrival time Amap launches upgraded version of driving ETA service: real-time analysis of current road conditions and more accurate estimated arrival time Apr 30, 2024 am 08:37 AM

According to news from this site on April 29, Amap officially announced the launch of an upgraded version of driving ETA (Note from this site: ETA is the estimated time of arrival, which refers to the estimated time it will take for the user to depart from the current moment and follow a given route to the destination. ) service, which aims to help users make more accurate route planning duration and traffic condition estimates, and assist users in making travel decisions. This map application is the latest upgraded Amap App. It introduces the "ultra-large-scale graph convolutional neural network model", which can better capture and learn traffic flow patterns, support urban road networks and highway systems, and can Accurately depict the spatiotemporal dynamic changes of traffic conditions. In addition, the new version of the map further integrates the iTransformer time series prediction model to support real-time analysis.

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:

See all articles