rater
Star rating widget for the browser.
Install
npm install rater-js --save
Usage
rater-js can be used with amd, commonjs or without any module loader using rater from global scope.
In your html create a new element that acts as the placeholder for the widget.
<link href="node-modules/rater-js/rater-js.css" rel="stylesheet">
<div id="rater"></div>
<script src="node-modules/rater-js/index.js"></script>
Node/Browserfiy
var rater = require("rater-js");
var myRater = rater({element: document.querySelector("#rater"), rateCallback: function rateCallback(rating) {
myRater.setRating(rating);
myRater.disable();
}});
See Example for more information.
Configuration
{
element: HtmlElement,
rateCallback: Function,
max: "Number of stars",
disableText: "Text",
ratingText: "Text {rating}",
readOnly: true/false
}
Methods
disable: Disable the widget
enable: Enable the widget
setRating(rating:number): Set the rating