亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

基于jQuery制作小圖標(biāo)上下滑動特效

 更新時間:2017年01月18日 09:36:14   作者:xiao_style  
一個小圖標(biāo)特效,非常有趣的,下面給大家分享基于jquery制作的小圖標(biāo)上下滑動特效,代碼簡單易懂,需要的朋友參考下

一個小圖標(biāo)特效,挺有趣的,代碼也很容易懂。

 jQ小圖標(biāo)上下滑動特效:

代碼如下:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title></title>
  </head>
  <link rel="stylesheet" href="css/normalize.css">
  <style>
   .tubiao{
    width: 300px;
    height: 100px;
    margin: 100px auto;
   }
   a{
    position: relative;
    padding: 10px;
    display: inline-block;
    text-decoration: none;
    color: #000;
    text-align: center;
   }
   i{
    position: absolute;
    left: 5px;
    top: -20px;
    opacity: 1;
   }
  </style>
  <body>
    <div class="tubiao">
      <a href="#"><i><img src="imges/小圖標(biāo)/1.png" alt="1" ></i><p>我的</p></a>
      <a href="#"><i><img src="imges/小圖標(biāo)/2.png" alt="2" ></i><p>你的</p></a>
      <a href="#"><i><img src="imges/小圖標(biāo)/3.png" alt="3" ></i><p>他的</p></a>
      <a href="#"><i><img src="imges/小圖標(biāo)/4.png" alt="4" ></i><p>好的</p></a>
      <a href="#"><i><img src="imges/小圖標(biāo)/5.png" alt="5" ></i><p>壞的</p></a>
    </div>/*css和html不解釋*/
    <script src="js庫/jquery.js"></script>/*jquery庫,路徑這里用漢字,我是看的方便,實際建議用英文*/
    <script>
      $(function(){
        $("a").mouseenter(function(){<br>                /*mouseenter和mouseover 都是 觸摸事件,前者是不冒泡,后者必然冒泡,解釋還是有點差強(qiáng)人意,前者也會發(fā)生不一樣的情況,就是超出子元素范圍,點在祖先元素還是會發(fā)生*/
          $(this).find("i").stop().animate({top:"-30px",opacity:"0"},300,function(){ <br>                   /*這里關(guān)鍵說一個,就是在anmiate()前面加stop(),是取消上一次事件,再繼續(xù),接下來的*/
            $(this).css({top:"-15px"});<br>                        /*這里是再次出現(xiàn)的關(guān)鍵,就是因為opacity是0嘛,我們就先悄悄的把top值,移到正常位置的下面一點點,然后再讓他出現(xiàn),即產(chǎn)生了繞了180deg的錯覺*/
            $(this).animate({top:"-20px",opacity:"1"},300)
          });
        })
      })
    </script>
  </body>
</html>

相關(guān)文章

最新評論