不二如是 发表于 2019-1-22 15:02:30

177-星级评分



玩法说明:

★不写代码,拿来直接用

★提供源码下载(悉听尊便)

★Write Once,Sex EveryWhere



代码包下载(回复“我爱鱼C”,即可看到源码包):
**** Hidden Message *****



特效展示:




如果喜欢,别忘了评分{:10_281:} :

http://xxx.fishc.com/forum/201709/19/094516hku92k2g4kefz8ms.gif

像番茄加两个蛋 发表于 2019-2-4 08:51:43

这好今天早上一起来就写了一个超简单的评分,我用JQuery写的。现在看看真正的星级评分是怎么实现的。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>五角星评分案例</title>
    <style>
      * {
            padding: 0;
            margin: 0;
      }

      .comment {
            font-size: 40px;
            color: rgb(206, 206, 0);
      }

      .comment li {
            float: left;
            cursor: pointer;
      }

      ul {
            list-style: none;
      }
    </style>
    <script src="jquery-1.12.2.js"></script>
    <script>
      $(function () {
            $('.comment>li').mouseover(function () {
                $(this).text('★').prevAll('li').text('★').end().nextAll('li').text('☆');
            }).mouseout(function () {
                $('.comment').find('li').text('☆');
                $('.comment>li').text('★').prevAll('li').text('★');
            }).click(function () {
                // 自定义属性
                $(this).attr('index','1').siblings('li').removeAttr('index');
                //
            });
      });
    </script>
</head>

<body>
<ul class="comment">
    <li>☆</li>
    <li>☆</li>
    <li>☆</li>
    <li>☆</li>
    <li>☆</li>
</ul>
</body>

</html>
页: [1]
查看完整版本: 177-星级评分