GithubHelp home page GithubHelp logo

pryley / star-rating.js Goto Github PK

View Code? Open in Web Editor NEW
97.0 5.0 15.0 696 KB

This zero-dependency ES6 module transforms a select with numerical-range values (i.e. 1-5) into a dynamic star rating element.

Home Page: https://pryley.github.io/star-rating.js/

License: MIT License

JavaScript 39.68% CSS 12.57% HTML 47.75%
star-rating vanilla-javascript zero-dependency es6

star-rating.js's Issues

Select second star when clicking outside of stars

Hi, I'm just trying your library and it looks really good, thanks!

I discovered a bug, when clicking outside of a star, the second star get selected.
You can reproduce this bug when clicking on a tooltip in your demo.

I guess it's coming from elementFromPoint that resolve to the tag gl-star-rating--stars instead of targeting star tags but I'm not sure.

Best,
Jason

Tooltip out of viewport

When using the star-rating plugin on a small screen, the tooltip ends up off the viewport?

Am I configuring something incorrect?

The ones clearly off the page are in a table cell, the ones below it are just in a div. But it seems like it doesn't shift the data when the viewport is close? Or maybe some way to move the tooltip to a different location?

2023-03-29_17-18-21

Cannot apply style

I try to change the color of stars with these css

`:root {
--gl-star-color: #FF7A00; /* if using SVG images /
--gl-star-color-inactive: #d9d9d9; /
if using SVG images */

}`

however the color of the stars are not chnaging. Are there anything i should do in order to chnage the color of the star?

Some bugs and ideas

Hi, Paul! First of all thanks for this awesome plugin. You did a great job! Now about the issues.

  1. Despite your fix in v3.4.0 there are still warnings in DevTools related to non-passive event listeners. I use latest Google Chrome (v89.0.4389.82) and Star-rating.js v4.1.1.
  2. Right-clicking on a rating triggers the select event. This is very annoying.
  3. It would be nice to implement fractional rating (with initialRating option). Now I do this way (maybe it will come in handy): codepen.

Sorry for my English. I would be grateful for your response!

Documentation doesn't show how to enable half-stars, or how to hook to selection events

It would be awesome if you could show a demo or document how to implement half stars. You package an image called half-star but I didn't see code support for half stars. Can you please clarify?

Additionally, how would I hook on to click events? Say, a user selected the 3rd stay, and I'd like to fire off a function when that happens. Can you please document how would one do that?

Set default value?

Hi,
I would like to know how to initialize the stars control with a default value.

Thanks

Make it possible to disable voting

Sometimes it make sense to only show the rating, for example in an archive with many items. Maybe it would be good to also be able to disable voting?

Add support for sliding across rating on mobile

On desktop if I hold click on a star and then drag the cursor to a different star and release the click then the selected rating will reflect the last star that the cursor was positioned on. This is a nice detail that gives the rating plugin a good sense of responsiveness.

However it does not appear that this behavior works on mobile, where tapping and then sliding across the stars does not register a selection (only a single tap on a star will register a selection).

It would be nice if the aforementioned behavior worked on mobile, allowing users to make adjustments to a rating by sliding their finger rather than having to perform another tap.

Thank you for sharing this plugin- it is my favorite JS rating plugin of the countless that I've looked at!

Can we use import statement

Hello,

I was just wondering if we could use the es6 import statement to load your lib into custom js modules ?

Thanks for this light lib by the way :)

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.