0.0.6 • Published 9 years ago

rating-gen v0.0.6

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

Ratings

Alt text

INSTALL

npm install rating-gen

This will install jquery 2.1.4 as a dependency

Copy the css from node_modules/rating-gen/rating.css in you html and adjust the fieldset font-size to change the size of stars. The css file imports font-awesome , so replace the path with your local copy.

Usage

var  Rating = require('rating-gen');
var $ = require('jquery');

var rating = new Rating({
    field: $('.rating-container'),
    defaultRating: 3,
    onSelect: function(rating) {
        alert(rating);
    }
});

if you are not using browserify/webpack simply copy the rating.js and rating.css files, remove the require lines and start using. Rating will be attached to the window object.

Options

  • readOnly: true, no hover effect and change in the ratings
  • _id: provide unique id if have multple star-ratings in the same html

Api

  • rating.get() - gives the current rating
  • rating.set(2) - will set the ratings
0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago