Giter VIP home page Giter VIP logo

stars-rating's Introduction

Stars rating control with two modes: fixed and mutable.

Mutable mode allows input from the user.

Among other features: colors cusomization and different star symbols.

See demo: stars-rating.meteor.com

In order to render markup with small font size use (or size='lg' for large):

{{> starsRating rating=4.5 size='sm'}}

You also can set exact font size in pixels by:

{{> starsRating rating=4.5 size=10}}

if you want user to iteract with the control and set a rating use:

{{> starsRating id='rating' mutable=true}}

To access saved value, get element by ID and then:

var rating = $('#rating').data('userrating');

For colors customization, add your own CSS class:

{{> starsRating id='rating' class='mystar' mutable=true}}

and follow snippet:

# Changes default color.
.mystar .current-rating {
  color: #color1;
}

# A color that highlights selected stars when user interacts with the control.
.mystar .active {
  color: #color2;
}

It's possible to set a different star symbol.

For example, add Awesome font package and CSS class setting font family:

.awesome {
  font-family: FontAwesome;
}

then configure a star symbol in the template:

{{> starsRating id='rating' star='\\f005' class='awesome' mutable=true}}

You will see rating with Awesome stars.

Tested: IE9+, Firefox35+, Chrome40+

API

There are one event and one method supported via jQuery API.

To subscribe on the star value changes use $('#rating').on('change', ...).

To reset a star do $('#rating').trigger('reset').

stars-rating's People

Contributors

barbatus avatar sarahmattar avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.