跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • Bilibili的关注心心动画代码
未分類
2018 年 9 月 26 日

Bilibili的关注心心动画代码

 

很好看的哔哩哔哩的关注按钮代码來了,有興趣可以放在自己網站/博客~

代码

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>模仿Bilibili关注的动画</title>
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    
    <style>
        .bangumi-order-d{
            background: url(http://s1.hdslb.com/bfs/static/bangumi/play/images/anim-order.png);
                display: inline-block;
                position: absolute;
                margin: 60px;
                margin-left: 4px;
                top: -20px;
                width: 60px;
                height: 60px;
                line-height: 28px;
                vertical-align: middle;
        }
    </style>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
    <i class="bangumi-order-d" style="background-position: -1860px -60px;"></i>
    <script>
        var w = 0;
        var i = -1;

        $('.bangumi-order-d').click(function(e){ 
            animat($(this),0); 
        })
        function animat($img,w){
            setTimeout(() => {
                $img.css("background-position","-"+ w +"px -60px")
                if(w<1860){
                    w=w+60;
                    animat($img,w);
                }else{
                    w=0
                }
            }, 66);
        }
    </script>
</body>
</html>

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具