码迷,mamicode.com
首页 > 编程语言 > 详细

python:点赞功能

时间:2016-12-08 23:32:47      阅读:211      评论:0      收藏:0      [点我收藏+]

标签:点赞   end   html4   contract   html   elf   gre   round   val   

技术分享
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .container {
            padding: 50px;
            border: 1px solid #dddddd;
        }

        .item {
            position: relative;
            width: 30px;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="item">
        <span></span>
    </div>
</div>
<div class="container">
    <div class="item">
        <span></span>
    </div>
</div>
<div class="container">
    <div class="item">
        <span></span>
    </div>
</div>
<div class="container">
    <div class="item">
        <span></span>
    </div>
</div>

<script src="jquery-1.12.4.js"></script>
<script>
    $(.item).click(function () {
        adFavor(this);
    });

    function adFavor(self) {
//        var t=$(self)
//        console.log(t)
        var fontSize = 15;
        var top = 0;
        var right = 0;
        var opacity = 1;
        var tag = document.createElement(span);
        $(tag).text(+1);
        $(tag).css(color, green);
        $(tag).css(fontSize, fontSize + px);
        $(tag).css(position, absolute);
        $(tag).css(top, top + px);
        $(tag).css(right, right + px);
        $(tag).css(opacity, opacity)
        $(self).append(tag)

        var v = setInterval(function () {
            fontSize = fontSize + 5;
            top = top - 5;
            right = right - 5;
            opacity = opacity - 0.2;
            $(tag).css(fontSize, fontSize + px);
            $(tag).css(top, top + px);
            $(tag).css(right, right + px);
            $(tag).css(opacity, opacity);
//            console.log(opacity)
            if (opacity < 0) {
                clearInterval(v);
                $(tag).remove();
//                移除这个标签
//                <span style="color: green; position: absolute; font-size: 45px; right: -30px; top: -30px; opacity: -0.2;">+1</span>
            }

        }, 40);

    }
</script>
</body>
</html>
点赞

 

python:点赞功能

标签:点赞   end   html4   contract   html   elf   gre   round   val   

原文地址:http://www.cnblogs.com/xuehuahongmei/p/6146748.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!