zoukankan      html  css  js  c++  java
  • 评价部分中星级评价简单的实现

    说明:主要是想总结一下jquery中的知识,这个例子中用到的主要是jquery中prevall()方法和nextAll()方法进行元素集合的遍历,效果如下图:

    使用的星星图片

          

    jquery部分
     $(function(){
        $(".star01 li").addClass("xing_nomarl");
        $(".star01 li").click(function(){
            $(".star01 li").addClass("xing_nomarl");
            $(this).addClass("xing_select");
            $(this).prevAll().addClass("xing_select");
            $(this).nextAll().removeClass("xing_select").addClass("xing_nomarl");
            var star_number = $(this).prevAll().length+1;
            //alert(star_number);
        })
    });
     
     html部分
     <ul class="star">
       <li></li>
       <li></li>
       <li></li>
       <li></li>
       <li></li>
    </ul>

    css部分
    .star{
        display:inline-block;
        padding-left:0;
        margin-bottom: -5px;
        }
    .star li{
        position:relative;
        padding-left:10px;
        float:left;
        cursor:pointer;
    }
    .xing_nomarl{
        18px;
        height:18px;
        display:block;
        margin:0 5px;
        background:url(xingxing_nomarl.png) no-repeat left center;
        background-size:100%;
        overflow:hidden;
        }
    .xing_select{
        18px;
        height:18px;
        display:block;
        margin:0 5px;
        background:url(xingxing_select.png) no-repeat left center;
        background-size:100%;
        overflow:hidden;
        }

  • 相关阅读:
    javascript中的XML
    OC
    Android SDCard Mount 流程分析
    开源库(要不要重新制造轮子)—— C/C++、Java、Python
    开源库(要不要重新制造轮子)—— C/C++、Java、Python
    罚函数(penalty function)的设计
    罚函数(penalty function)的设计
    DTFT、DFT、FFT
    DTFT、DFT、FFT
    帕斯瓦尔定理(Parseval's theorem)
  • 原文地址:https://www.cnblogs.com/wjh0916/p/4831838.html
Copyright © 2011-2022 走看看