css/jquery 笑脸评价

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>笑脸评价</title>
    <script src="../js/jquery-3.2.1.min.js"></script>
<style>
 .smile_bad,.smile_med,.smile_good{
            width: 0.3rem;
            height: 0.3rem;
            background-repeat: no-repeat;
            display: inline-block;
        }
         .smile_bad{
            background-image:url("../img/bad_normal.png");
            background-size: 0.3rem;
        }
        .smile_med{
            background-image:url("../img/med.png");
            background-size: 0.3rem;
        }
        .smile_good{
            background-image:url("../img/good_normal.png");
            background-size: 0.3rem;
        }
        .bad_active{
            background-image:url("../img/bad-active@3x.png");
            background-size: 0.3rem;
        }
        .med_active{
            background-image:url("../img/med-active@3x.png");
            background-size: 0.3rem;
        }
        .good_active{
            background-image:url("../img/good-active@3x.png");
            background-size: 0.3rem;
        }
</style>
</head>
<body>
      <div class="smile_images">
                 <span  class="smile_bad"> </span>
                 <span class="smile_med"></span>
                 <span class="smile_good"></span>
      </div>
</body>

<script>
$(function(){
    $(".smile_bad").click(function(){
        $(".smile_bad").toggleClass('bad_active');
    });
    $(".smile_med").click(function(){
        $(".smile_med").toggleClass('med_active');
    });
    $(".smile_good").click(function(){
        $(".smile_good").toggleClass('good_active');
    });
})
</script>
</html>

点击来回切换图片


这里写图片描述
这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值