All Projects → fredolss → rater-js

fredolss / rater-js

Licence: MIT license
Star rating widget for the browser. Unlimited number of stars. No dependencies. No Jquery required.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to rater-js

Raty
🌟 Raty - A Star Rating Plugin
Stars: ✭ 2,292 (+3372.73%)
Mutual labels:  rating, voting, vote, star, star-rating
react-star-ratings
A customizable svg star rating component for selecting x stars or visualizing x stars
Stars: ✭ 128 (+93.94%)
Mutual labels:  rating, star, star-rating-component, star-rating
react-ratings-declarative
A customizable rating component for selecting x widgets or visualizing x widgets
Stars: ✭ 41 (-37.88%)
Mutual labels:  rating, rater, star-rating
react-native-rating-element
A simple rating library for react native supporting: decimal points, direction aware icons, custom icon set from Ionicons, custom images and record rating given by users.
Stars: ✭ 19 (-71.21%)
Mutual labels:  rating, star-rating-component, star-rating
Laravel Love
Add Social Reactions to Laravel Eloquent Models. It lets people express how they feel about the content. Fully customizable Weighted Reaction System & Reaction Type System with Like, Dislike and any other custom emotion types. Do you react?
Stars: ✭ 822 (+1145.45%)
Mutual labels:  rating, vote, star
rating
⭐ A true Bayesian rating system with scope and cache enabled
Stars: ✭ 49 (-25.76%)
Mutual labels:  rating, vote, star-rating
yii2-vote
Provides voting for any model 👍 👎
Stars: ✭ 70 (+6.06%)
Mutual labels:  rating, voting, vote
Andratingbar
A RatingBar library for android, you can customize size ,color ,spacing and image easily!Support right to left。效果可以参看:https://juejin.im/post/6844904143220391949
Stars: ✭ 582 (+781.82%)
Mutual labels:  rating, star
React Native Star Rating
A React Native component for generating and displaying interactive star ratings
Stars: ✭ 724 (+996.97%)
Mutual labels:  rating, star
Awesomstar
Awesome (star)rating system with PHP, MySQL and pure JavaScript.
Stars: ✭ 15 (-77.27%)
Mutual labels:  rating, star
Laravel Reactions
Laravel reactions package for implementing reactions (eg: like, dislike, love, emotion, etc) on Eloquent models.
Stars: ✭ 58 (-12.12%)
Mutual labels:  rating, star
MsalsasVotingBundle
Provides voting/rating management for your Symfony project.
Stars: ✭ 14 (-78.79%)
Mutual labels:  rating, voting
Bootstrap Star Rating
A simple yet powerful JQuery star rating plugin with fractional rating support.
Stars: ✭ 985 (+1392.42%)
Mutual labels:  rating, star
Mgstarratingview
MGStarRatingView is a view for rating.
Stars: ✭ 70 (+6.06%)
Mutual labels:  rating, star
Android Ratingreviews
Simple star rating system bars, a view similar to the ones seen on Google Playstore. ⭐🌟✨
Stars: ✭ 110 (+66.67%)
Mutual labels:  rating, star
Rateit.js
Rating plugin for jQuery. Fast, Progressive enhancement, touch support, icon-font support, highly customizable, unobtrusive JavaScript (using HTML5 data-* attributes), RTL support, supports as many stars as you'd like, and also any step size.
Stars: ✭ 146 (+121.21%)
Mutual labels:  rating, star
Yii2 Widget Rating
A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)
Stars: ✭ 47 (-28.79%)
Mutual labels:  rating, star
Upvotejs
UpvoteJS generates a voting widget like the one used on Stack Exchange sites
Stars: ✭ 137 (+107.58%)
Mutual labels:  widget, voting
Starrate
swift电商五星评价,星星评分控件,支持自定义数量、拖拽、间隔、设置最小星星数等操作
Stars: ✭ 85 (+28.79%)
Mutual labels:  rating, star
Hibiscus.js
Native Angular directives for Bootstrap4
Stars: ✭ 115 (+74.24%)
Mutual labels:  widget, rating

Rater Js

rater-js Logo Donate NPM version License Downloads Build Status

rater-js is a star rating widget for the browser.

Main features:

  • Unlimited number of stars.
  • Svg as background image makes it look good in any size.
  • Custom css. Use your own image as star.
  • RTL support.
  • Touch support.

Try Rater JS Demo →

Installation

npm install rater-js --save

Usage

rater-js can be used with amd, commonjs or without any module loader using global scope.

In your html create an element that acts as the placeholder for the widget.

<div id="rater"></div>

Global scope

Directly reference the js from the module

<!--Add js before end body tag-->
<script src="node-modules/rater-js/index.js"></script>

The widget will be available globally as "raterJs" on the window object.

Node/Browserify

Just require the module.

var rater = require("rater-js");

Lastly we can use the widget like this:

 var myRater = rater({element: document.querySelector("#rater"), rateCallback: function rateCallback(rating, done) {
                //make async call to server however you want
                //in this example we have a 'service' that rate and returns the average rating
                myDataService.rate(rate).then(function(avgRating) {
                    //update the avarage rating with the one we get from the server
                    myRater.setRating(avgRating);
                     //we could disable the rater to prevent another rating
                     //if we dont want the user to be able to change their mind
                    myRater.disable();
                    //dont forget to call done
                    done();
                }, function(error) {
                        //handle the error
                        //dont forget to call done
                        done();
                });
	}});

Css will be injected at runtime, but you can override the css to get the look you want.

//change the whole image used as the star. Make sure to set starSize in options if not 16px.
//first image is for the 'off' mode
.star-rating {
        background: url("myStar_off.svg") !important;
}

//add style for 'on' mode
.star-rating .star-value{
        background: url("myStar_on.svg") !important;
}

Configuration

Property Description
element HtmlElement. Required.
rateCallback Function. Triggered when star i clicked.
max Number. Number of stars to show.
showToolTip true/false. If set to true, show tooltip when hover the stars.
starSize Number. Width and height of the star image.
disableText Text to show when disabled.
ratingText Text to show when hover over stars. Text {rating} {maxRating}.
isBusyText Displayed while user is rating but done not called yet.
readOnly true/false. If set to true, will disable the rater.
step Number. Set a precision between 0 and 1 for the rating.
reverse true/false. If set to true, the ratings will be reversed.

Methods/Properties

disable(): //Disable the widget
enable(): //Enable the widget
setRating(rating:number): //Set the rating
getRating(): //Get the average rating
dispose(); //Removes event handlers
clear(); //Clears the rating
element; //Get the element used by rater js
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].