Home > Web Front-end > JS Tutorial > Create a fluid navigation menu with Jquery CSS Fluid Navigation_jquery

Create a fluid navigation menu with Jquery CSS Fluid Navigation_jquery

WBOY
Release: 2016-05-16 18:34:14
Original
1085 people have browsed it

So how should we implement a mobile navigation menu?
1. Rendering


Mouse over the Menu to show the prompt information.
2. Implementation steps
1. CSS code

Copy code The code is as follows:

menuBarHolder { width: 730px; height:45px; background-color:#000; color:#fff; font-family:Arial; font-size:14px; margin-top:20px;}
#menuBarHolder ul{ list-style-type:none; display:block;}
#container { margin-top:100px;}
#menuBar li{ float:left; padding:15px; height:16px; width:50px; border -right:1px solid #ccc; }
#menuBar li a{color:#fff; text-decoration:none; letter-spacing:-1px; font-weight:bold;}
.menuHover { background- color:#999;}
.firstchild { border-left:1px solid #ccc;}
.menuInfo { cursor:hand; background-color:#000; color:#fff;
width:74px ; font-size:11px;height:100px; padding:3px; display:none;
position:absolute; margin-left:-15px; margin-top:-15px;
-moz-border-radius- bottomright: 5px;
-moz-border-radius-bottomleft: 5px;
-webkit-border-bottom-left-radius: 5px;
-webkit-border-bottom-right-radius: 5px;
-khtml-border-radius-bottomright: 5px;
-khtml-border-radius-bottomleft: 5px;
border-radius-bottomright: 5px;
}

menuBarHolder: fixed container of menuMenu, width=730px.
menuInfo: Control whether prompt information is displayed or not.
2. HTML code

Copy code The code is as follows:


UI LI element: list element.
DIV element: Prompt content information.
3. Javascript code

Copy code The code is as follows:
$(document). ready(function()
{
$('#menuBar li').click(function()
{
var url = $(this).find('a').attr( 'href');
document.location.href = url;
});
$('#menuBar li').hover(function()
{
$(this) .find('.menuInfo').slideDown();
},
function()
{
$(this).find('.menuInfo').slideUp();
});
});


click(), hover(): Bind click events and mouse over events to Li elements.
find() function: Search for all elements matching the specified expression. This function is a great way to find out the descendant elements of the element being processed.
slideDown(speed, [callback]): Dynamically display all matching elements through height changes (increase downward), optionally triggering a callback function after the display is completed.
slideUp(speed, [callback]): Dynamically hide all matching elements by changing the height (decreasing upward), optionally triggering a callback function after the hiding is completed.

[Ctrl A Select All Note:
If you need to introduce external Js, you need to refresh to execute ]

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