jQuery星级评分插件的使用问题

WhiteRice
  • 25

今天在网上搜索到一个jQuery的星级评分插件,觉得页面不错就下载下来准备用到自己的项目上,碰到一个问题就是最后示例中显示的星星图标显示不了,我和示例一样加载了2个css文件和2个js文件,不知道问题出在哪里:

评分插件下载地址:
http://www.jq22.com/jquery-info460

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>Krajee JQuery Plugins - &copy; Kartik</title>
    <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
    <link href="../css/star-rating.css" media="all" rel="stylesheet" type="text/css"/>
    <script src="../js/star-rating.js" type="text/javascript"></script>
<body>


<h1>Bootstrap Star Rating Example</h1>




<div class="container">
<form>
    <input id="input-2b" type="number" class="rating" min="0" max="5" step="0.5" data-size="xl"
    data-symbol="&#xe005;" data-default-caption="{rating} hearts" data-star-captions="{}">
    <br>
    <input id="input-21a" value="0" type="number" class="rating" min=0 max=5 step=0.5 data-size="xl" >
    <br>
    <input id="input-21b" value="4" type="number" class="rating" min=0 max=5 step=0.2 data-size="lg">
    <br>
    <input id="input-21c" value="0" type="number" class="rating" min=0 max=10 step=0.5 data-size="xl" data-stars="8">
    <br>
    <input id="input-21d" value="2" type="number" class="rating" min=0 max=5 step=0.5 data-size="sm">
    <br>
    <input id="input-21e" value="0" type="number" class="rating" min=0 max=5 step=0.5 data-size="xs" >
    <br>
    <input id="input-21f" value="0" type="number" class="rating" min=0 max=5 step=0.5 data-size="md" >
    <br>
    <input id="input-2ba" type="number" class="rating" min="0" max="5" step="0.5" data-stars=5
    data-symbol="&#xe005;" data-default-caption="{rating} hearts" data-star-captions="{}">
    <br>
    <input id="input-22"  value="0" type="number" class="rating" min=0 max=5 step=0.5 data-rtl=1 data-container-class='text-right' data-glyphicon=0>
    <div class="clearfix"></div>
    <div class="form-group">
    <button type="submit" class="btn btn-primary">Submit</button>
    <button type="reset" class="btn btn-default">Reset</button>
    </div>
</form>
<br>
<script>
    jQuery(document).ready(function () {
        $(".rating-kv").rating();
    });
</script>

</div>


</body>
</html>

我部署到我自己本地的代码:

<html>
<head>
    <meta charset=utf-8>
    <link rel="stylesheet" href="bootstrap.css"  type="text/css">
    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>

    <link href="star-rating.min.css" media="all" rel="stylesheet" type="text/css" />
    <script src="bootstrap.js"></script>
    <script src="star-rating.js" type="text/javascript"></script>
    <link rel="stylesheet" href="mycss.css" type="text/css">
</head>
<body>
    <div class="btn-group">
        <button type="button" class="btn btn-warning dropdown-toggle width120px" data-toggle="modal" data-target="#difficultyModal"aria-expanded="false">
            <h1 class="margin0">7/10</h1>
            <h5 class="margin0">难度</h5>
        </button>
    </div>

    <input id="input-21a" value="0" type="number" class="rating" min=0 max=5 step=0.5 data-size="xl" >




<div class="modal fade" id="difficultyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">

            <div class="modal-header">
                <h4 class="modal-title" id="myModalLabel">
                请为难度打分,10分最难哦
                </h4>
            </div>

            <div class="modal-body">
                <input id="input-21a" value="0" type="number" class="rating" min=0 max=5 step=0.5 data-size="xl">
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">
                保存
                </button>
                <button type="button" class="btn btn-default" data-dismiss="modal">
                放弃
                </button>
            </div>
        </div>
    </div>
</div>


    <script>
    jQuery(document).ready(function () {
        $(".rating-kv").rating();
    });
</script>


</body>
</html>
回复
阅读 8.2k
4 个回答

我看了下,插件不支持IE6 - 9,我去

图片路径是对?

sparyli
  • 1
新手上路,请多包涵
宣传栏