欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

基于jQuery實現(xiàn)鼠標點擊導航菜單水波動畫效果附源碼下載

 更新時間:2016年01月06日 16:47:10   作者:愛上程序猿  
這篇文章主要介紹了基于jQuery實現(xiàn)鼠標點擊導航菜單水波動畫效果附源碼下載,需要的朋友參考下

基于jQuery鼠標點擊水波動畫豎直導航代碼。這是一款基于jQuery+CSS3實現(xiàn)的帶動畫效果的豎直導航欄特效。效果圖如下:

效果展示    源碼下載

html代碼:

<div class="nav">
  <ul>
   <li><a>網(wǎng)站首頁</a></li>
   <li><a>關于我們</a></li>
   <li><a>產(chǎn)品中心</a></li>
   <li><a>成功案例</a></li>
   <li><a>聯(lián)系我們</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>

以上代碼是本文的核心代碼,比較簡單,大家可以根據(jù)需求,適當?shù)奶砑觿h除代碼。

相關文章

最新評論