微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Raty

编程之家收集整理的这个编程导航主要介绍了Raty编程之家,现在分享给大家,也给大家做个参考。

Raty 介绍

使用jQuery Raty,可以很方便的在页面上嵌入一个评分组件  

引用以下文件

<script type="text/JavaScript" src="demo/js/jquery.min.js"></script>

<script type="text/JavaScript" src="lib/jquery.raty.min.js"></script>

html结构

<div width:500px; margin:100px auto;">

<div class="demo">

<div id="function-demo" class="target-demo"></div>

<div id="function-hint" class="hint"></div>

</div>

<div class="demo">

<div id="function-demo1" class="target-demo"></div>

<div id="function-hint1" class="hint"></div>

</div>

</div>

js调用方法

$(function() {

$.fn.raty.defaults.path = 'lib/img';

$('#function-demo').raty({

number: 5,//多少个星星设置

targettype: 'hint',//类型选择,number是数字值,hint,是设置的数组值

path: 'demo/img',

hints: ['差','一般','好','非常好','全五星'],

cancelOff: 'cancel-off-big.png',

cancelOn: 'cancel-on-big.png',

size: 24,

starHalf: 'star-half-big.png',

sTaroff: 'star-off-big.png',

sTaron: 'star-on-big.png',

target: '#function-hint',

cancel: false,

targetKeep: true,

targetText: '请选择评分',

click: function(score,evt) {

alert('ID: ' + $(this).attr('id') + "nscore: " + score + "nevent: " + evt.type);

}

});

$('#function-demo1').raty({

number: 10,//多少个星星设置

score: 2,//初始值是设置

targettype: 'number',

target: '#function-hint1',

precision: false,//是否包含小数

click: function(score,evt) {

alert('ID: ' + $(this).attr('id') + "nscore: " + score + "nevent: " + evt.type);

}

});

});

网站地址:https://wbotelhos.com/raty

GitHub:https://github.com/wbotelhos/raty

网站描述:一个非常棒的jQuery 评分插件

Raty

官方网站:https://wbotelhos.com/raty

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。