zoukankan      html  css  js  c++  java
  • JQ简单点赞功能

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <title>JQ简单点赞功能</title>
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    </head>
    <body>
    <style>
        .lala{
            color:#999;
            margin:10vh;
            cursor:pointer;
        }
    </style>
    <div class="lala noStyle">
        <span class="number">89</span>
        <span class="heart"></span>
    </div>
    
    <script>
        $(function(){
            var numberText=parseInt($(".number").text());
            $(".lala").click(function(){
                if($(this).hasClass("noStyle")){
                    numberText+=1;
                    $(this).find(".heart").css("color","red");
                    $(this).find(".number").html(numberText);
                    $(this).find(".number").css("color","red");
                    $(this).removeClass("noStyle");
                }else{
                    numberText-=1;
                    $(this).find(".heart").css("color","#999");
                    $(this).find(".number").html(numberText);
                    $(this).find(".number").css("color","#999");
                    $(this).addClass("noStyle");
                }
            })
        })
    </script>
    
    
     </body></html>
  • 相关阅读:
    Python-手动安装第三方包
    SQL SERVER-根据jobID查job
    python-包模块等概念
    锁表
    Python-try异常捕获
    胶水语言
    C++之多态性与虚函数
    android
    开源许可协议
    hal
  • 原文地址:https://www.cnblogs.com/fkcqwq/p/11131566.html
Copyright © 2011-2022 走看看