效果展示 http://hovertree.com/texiao/nav/3/
jQuery漂亮图标的垂直导航菜单 是一款当鼠标滑过菜单项时,会有一个背景遮罩层跟着鼠标移动,效果非常炫酷,图标还是矢量图。
效果图如下:
HTML文件代码如下:
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery SVG图标垂直导航菜单代码 - 何问起</title><base target="_blank" />
<link rel="stylesheet" href="http://hovertree.com/texiao/nav/3/css/style.css">
<style>
body{
background: #494A5F;
color: #D5D6E2;
font-weight: 500;
font-size: 1.05em;
}
a{color:mediumvioletred}
</style>
</head>
<body> <div style="text-align:center;margin:5px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<h1>jQuery SVG图标垂直导航菜单</h1> <!--何问起提示:菜单开始-->
<div class="menu-container">
<menu>
<a href="http://hovertree.com">
<menuitem>
<img src="http://hovertree.com/texiao/nav/3/img/144211.svg" />
avocado
</menuitem>
</a>
<a href="http://hovertree.com/menu/texiao/">
<menuitem>
<img src="http://hovertree.com/texiao/nav/3/img/144207.svg" />
banana
</menuitem>
</a>
<a href="http://hovertree.com/h/bjaf/30dq3r8y.htm">
<menuitem>
<img src="http://hovertree.com/texiao/nav/3/img/144210.svg" />
cherry
</menuitem>
</a>
<a href="http://hovertree.com/h/bjaf/ati6k7yk.htm">
<menuitem>
<img src="http://hovertree.com/texiao/nav/3/img/144198.svg" />
eggplant
</menuitem>
</a>
</menu>
<div class="sliding-bar"></div>
</div>
<!--何问起提示:菜单结束--> <p>请移动光标到菜单项上。适用浏览器:Chrome、Edge、FireFox、Opera、傲游、360、搜狗、世界之窗等新版浏览器。</p>
<p>
来源:<a href="http://hovertree.com/" target="_blank">何问起</a>
<a href="http://hovertree.com/menu/texiao/">网页特效</a>
<a href="http://hovertree.com/h/bjaf/buik5tfi.htm">代码说明</a>
</p>
</div> <script src="http://down.hovertree.com/jquery/jquery-3.0.0.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(window).ready(function(){
initMenu();
}); $('menuitem').hover(function(){
var offset = $(this).offset();
$('.sliding-bar').offset(offset);
}); $('menu').hover(function(){
$('.sliding-bar').css({opacity:1});
},function(){
$('.sliding-bar').css({opacity:0});
}) var initMenu = function () {
var $initElem = $('menuitem:first-of-type');
var initOffset = $initElem.offset();
var initSize = {
width: $initElem.css('width'),
height: $initElem.css('height')
}
$('.sliding-bar')
.offset(initOffset)
.css(initSize)
}
// hwq2.com
</script> </body>
</html>