分类分类
更新时间:2026-02-18 21:03:24作者:fang
基于jQuery鼠标点击水波动画竖直导航代码。这是一款基于jQuery+CSS3实现的带动画效果的竖直导航栏特效。效果图如下:

html代码:
<div class="nav">
<ul>
<li><a>网站首页</a></li>
<li><a>关于我们</a></li>
<li><a>产品中心</a></li>
<li><a>成功案例</a></li>
<li><a>联系我们</a></li>
<li><a>在线留言</a></li>
</ul>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript">
//jQuery time
var parent, ink, d, x, y;
$(".nav ul li a").click(function (e) {
parent = $(this).parent();
//create .ink element if it doesn't exist
if (parent.find(".ink").length == 0)
parent.prepend("<span class='ink'></span>");
ink = parent.find(".ink");
//incase of quick double clicks stop the previous animation
ink.removeClass("animate");
//set size of .ink
if (!ink.height() && !ink.width()) {
//use parent's width or height whichever is larger for the diameter to make a circle which can cover the entire element.
d = Math.max(parent.outerWidth(), parent.outerHeight());
ink.css({ height: d, width: d });
}
//get click coordinates
//logic = click coordinates relative to page - parent's position relative to page - half of self height/width to make it controllable from the center;
x = e.pageX - parent.offset().left - ink.width() / 2;
y = e.pageY - parent.offset().top - ink.height() / 2;
//set the position and add class .animate
ink.css({ top: y + 'px', left: x + 'px' }).addClass("animate");
})
</script>
以上代码是本文的核心代码,比较简单,大家可以根据需求,适当的添加删除代码。
相关
归墟战纪策略游戏262.92 MBv3.95802026-02-14
下载爆裂老奶策略游戏209.43 MBv1.0.112026-02-14
下载超能下蛋鸭策略游戏395.4 MBv1.2.82026-02-14
下载你好盒子实用工具12.1 MBv2.2.852026-02-14
下载我在峡谷当牛马休闲益智87.95 MBv0.7.12026-02-14
下载抽卡监狱2策略游戏190.75 MBv1.4.92026-02-14
下载Campus社交通讯94.36 MBv1.19.02026-02-14
下载冒险传奇角色扮演141.73 Mv9991.12026-02-14
下载心动次元app社交通讯43.96 Mv1.0.1.32026-02-14
下载致亲爱的我角色扮演1.63Gv1.02026-02-14
下载狼伴侣游戏手机版冒险游戏155.6 Mv1.02026-02-14
下载Loclike社交通讯169.08 Mv2.2.112026-02-14
下载










