• 文章介绍
  • 评价建议
  • 一款简洁漂亮的基于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>
    

    OC共享平台----官方网址www.ocvoc.com 微信公众号ocvocc 可查询欧闪科技 本站免费资源 需要投广告,赞助的请多多支持,谢谢!
    欧闪科技---oc平台专业提供小程序源码|网站源码|Office素材|游戏服务端|棋牌源码服务端||装修素材|MAC软件下载|免费电影|教育资讯|视频点播|jquery特效 » jQuery+CSS3点击水波动画竖直导航栏代码

    Leave a Reply

    提供最优质的资源集合

    立即查看 了解详情

    Optimized by WPJAM Basic