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

猜你喜欢

转载自blog.csdn.net/linwha1990/article/details/78987422