jQuery.raty评分插件使用方法

$(function() {
    $(".raty").raty({
        number: 5,
        score: function() {
            return $(this).attr('data-score');
        },
        targetType: 'hint',
        path: RESOURCE_ADMIN_URL + 'js/jquery.raty/img',
        hints: ['差', '一般', '好', '非常好', '全五星'],
        cancelOff: 'cancel-off.png',
        cancelOn: 'cancel-on.png',
        starHalf: 'star-half.png',
        starOff: 'star-off.png',
        starOn: 'star-on.png',
        cancel: true,
        targetKeep: true,
        cancelHint: '取消星级',
        precision: true,//开启小数
        click: function(score, evt) {
            var $this = $(this);
            var sId = $this.parents('tr[data-id]').attr('data-id');
            var star = score.toFixed(1);
            $.getJSON(url, data,
            function(json) {});
        }
    })
})

你可能感兴趣的:(JS,jQuery)