<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>清晰和完美的jQuery垂直菜单</title>
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script>
$(document).ready(function () {
//Set the height of the block
$('#menu .block').height($('#menu li').height());
//go to the default selected item
topval = $('#menu .selected').position()['top'];
$('#menu .block').stop().animate({top: topval}, {easing: '', duration:500});
$('#menu li').hover(
function() {
//get the top position
topval = $(this).position()['top'];
//animate the block
//you can add easing to it
$('#menu .block').stop().animate({top: topval}, {easing: '', duration:500});
//add the hover effect to menu item
$(this).addClass('hover');
},
function() {
//remove the hover effect
$(this).removeClass('hover');
}
);
});
</script>
<style>
#menu {
font-family:verdana;
font-size:12px;
position:relative;
margin:0 auto;
width:200px;
}
#menu ul {
/* remove list style */
list-style:none;
padding:0;
margin:0;
/* set the layer position */
position:relative;
z-index:5;
}
#menu li {
/* set the styles */
background:#ccc url(bg.gif) no-repeat 0 0;
padding:5px;
margin:2px;
cursor:pointer;
border:1px solid #ccc;
}
#menu li.hover {
/* on hover, change it to this image */
background-image:url(bg_hover.gif) !important;
}
#menu li a {
text-decoration:none;
color:#888;
}
#menu .block {
/* allow javascript to move the block */
position:absolute;
top:0;
/* set the left position */
left:150px;
/* display above the #menu */
z-index:10;
/* the image and the size */
background:transparent url(arrow.png) no-repeat top right;
width:39px;
padding:4px;
cursor:pointer;
}
/* fast png fix for ie6 */
* html .png{
position:relative;
behavior: expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''),
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "', sizingMethod='crop')",
this.runtimeStyle.backgroundImage = "none")),this.pngSet=true));
}
</style>
</head>
<body>
<br/><br/><br/>
<div id="menu">
<ul>
<li><a href="#">Item 01</a></li>
<li><a href="#">Item 02</a></li>
<li class="selected"><a href="#">Item 03</a></li>
<li><a href="#">Item 04</a></li>
<li><a href="#">Item 05</a></li>
<li><a href="#">Item 05</a></li>
</ul>
<div class="block png"></div>
</div>
</body>
</html>
jQuery制作垂直箭头菜单.zip
版权申诉
195 浏览量
2022-11-24
12:30:44
上传
评论
收藏 55KB ZIP 举报
芝麻粒儿
- 粉丝: 6w+
- 资源: 2万+
最新资源
- Picasso_v3.1 2.ipa
- chromedriver-mac-arm64.zip
- 蓝zapro.apk
- chromedriver-linux64.zip
- UCAS研一深度学习实验-MNIST手写数字识别python源码+详细注释(高分项目)
- 基于Python和PyTorch框架完成的一个手写数字识别实验源码(带MINIST手写数字数据集)+详细注释(高分项目)
- 基于Matlab在MNIST数据集上利用CNN完成手写体数字识别任务,并实现单层CNN反向传播算法+源代码+文档说明(高分项目)
- NVIDIA驱动、CUDA和Pytorch及其依赖
- 基于SVM多特征融合的微表情识别python源码+项目说明+详细注释(高分课程设计)
- html动态爱心代码一(附源码)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈