一款简洁漂亮的基于jQuery+CSS3实现的带水波动画效果的竖直导航栏代码,鼠标点击导航菜单链接出现水波动画特效。
js代码
<script type="text/javascript" src="https://img.x22t.com/file/2020/04/25/6eaaee32446acaddb89fa300c79dc3bc7367.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>
声明:本站资源均来源于互联网,如侵犯您的权益,请联系邮箱:afengim@88.com。谢谢,我们将在一天内进行处理。购买资源及会员后不支持退款,但我们将尽心尽力的为您解决问题,有任何问题联系QQ:3207346758;如您是游客模式下购买的资源,建议您立即注册账号(推荐使用QQ登录)以永久保留您的购买记录(可无限次下载)防止订单丢失造成损失。下载或购买资源即代表您已详细阅读并理解且同意 用户协议及下载须知