jQuery星级评分插件的使用问题
今天在网上搜索到一个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 - © 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="" 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="" 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
你自己的项目里用的bootstrap.css,里面有这样的代码url(../fonts/glyphicons-halflings-regular.woff) 和url(../fonts/glyphicons-halflings-regular.ttf),所以需要这两个文件,通过下面的连接下载
http://netdna.bootstrapcdn.com/bootstrap/3.1.0/fonts/glyphicons-halflings-regular.woff,
http://netdna.bootstrapcdn.com/bootstrap/3.1.0/fonts/glyphicons-halflings-regular.ttf
建议题主以后问类似的问题时,请先学会使用如下三个网站,在上面重现后再来发问:
我看了下,插件不支持IE6 - 9,我去
图片路径是对?