jquery version Slider navigation bar

Source: Internet
Author: User

<! DOCTYPE html>
<meta charset= "UTF-8" >
<script src= "Js/jquery-1.9.1.min.js" type= "Text/javascript" charset= "Utf-8" ></script>
<title> Small slider navigation bar </title>
<style type= "Text/css" >
*{
margin:0;
padding:0;
}
. ulbox{
position:relative;
Clear:both;
}
. nav{
height:30px;
line-height:30px;
}
. Nav li{
List-style:none;
Display:block;
Float:left;
}
. Nav Li a{
Display:block;
Background-color: #000;
Text-decoration:none;
Color: #FFFFFF;
border-radius:5px;
}
span{
Position:absolute;
bottom:0;
Display:block;
height:3px;
Background-color: #FF6600;
}
</style>
<body>
<div class= "Ulbox" >
<ul class= "NAV" >
<li><a href= "#" > Navigation </a></li>
<li><a href= "#" > Navigation two </a></li>
<li><a href= "#" > Navigation three </a></li>
<li><a href= "#" > Navigation four </a></li>
<li><a href= "#" > Navigation five </a></li>
<li><a href= "#" > Navigation six </a></li>
<li><a href= "#" > Navigation VII </a></li>
</ul>
<span class= "line" ></span>
</div>
</body>
<script type= "Text/javascript" >
$ (function () {
$ ('. Ulbox. Nav li '). Hover (function () {
var width=$ (this). Outerwidth (true);//Gets the width of the current Li
var left=$ (this). Offset (). Left; Gets the left value of the current Li
$ (". Line").-Stop (true). Animate ({' Left ': Left, ' width ': width},300);//Add a slide effect to the span tag
},function () {
$ (". Line"). Animate ({' Left ': ' 0 ', ' width ': ' 0 '},1000); Animation when mouse moves out of Li
});
})
. Stop (), stop the current animation, continue to the next animation, when the mouse moves hover, the animation and display is not synchronized, the display does not reach the expected results.
. Stop (true); Clears all animations of the element, stops in the current state
. Stop (false,true); Let the current animation go directly to the end state and continue to the next animation
. Stop (true,true); Clears all animations of the element so that the current animation reaches the end state directly
</script>

jquery version Slider navigation bar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.