<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>滑动导航</title> </head> <body> <ul class="slid"> <li><a href="#" rel="external nofollow" rel="external nofollow" >滑动到岗</a></li> <li><a href="#" rel="external nofollow" rel="external nofollow" >滑动到岗</a></li> <span id="navLine"></span> </ul> <script type="text/JavaScript" src="js/jQuery-1.9.1.min.js"></script> </body> </html>
<style type="text/css">
body,div,p{
margin:0;
padding:0;
}
ul.slid{
display: block;
position:fixed;
top: 10px;
left:0px;
right:0px;
height:60px;
background: #f2f2f2;
overflow: height;
}
ul.slid li{
display: inline-block;
width: 49%;
height: 40px;
margin-top: 10px;
float: left;
text-align: center;
overflow: hidden;
}
ul.slid li:first-child{
border-right: 1px solid red;
}
ul.slid li a{
display: inline-block;
width: 120px;
text-decoration:none;
height:37px;
line-height: 37px;
color: #898989;
overflow: hidden;
}
ul.slid li a:hover{
color: red;
}
#navLine{
height:2px;
background-color:red;
position:absolute;
bottom:7px;
width:0px;
left:0px;
display:none;
overflow:hidden;
}
</style>
<script type="text/javascript">
$(function (){
navSlid();
});
//滑动导航
var navSlid = function(){
var nline = $('#navLine');
var lia = $('ul.slid li a');
//初始化滑块
nline.css({
'width':lia.width(),
'left' :parseInt(lia.position().left)
});
$('ul.slid li a').mouseenter(function(){
//显示滑块
if(nline.css('display') == 'none'){
nline.show();
};
//移动滑块
nline.stop().animate({
width: $(this).width(),
left: parseInt($(this).position().left)
},300);
});
};
</script>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有