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;
        }

  • 相关阅读:
    Oracel System.Data.OracleClient requires Oracle client software version 8.1.7 or greater错误的解决方法
    oracle中CASE 的用法(摘录)
    ajaxpro 的一些用法,是在vs.net2003上
    我所知道的web下的打印方法
    电容触摸技术实用教程
    BLE资料应用笔记 持续更新
    蓝牙BLE实用教程
    README
    android 应用笔记
    Git 教程
  • 原文地址:https://www.cnblogs.com/wjh0916/p/4831838.html
Copyright © 2011-2022 走看看