
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
star-rating-svg
Advanced tools
###Features:
For a working demo, see: http://nashio.github.io/star-rating-svg/demo
Include jQuery:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
Include plugin's code:
<script src="jquery.star-rating-svg.js"></script>
Include plugin's css:
<link rel="stylesheet" type="text/css" href="star-rating-svg.css">
Add the markup
<div class="my-rating"></div>
Call the plugin:
$(".my-rating").starRating({
starSize: 25,
callback: function(currentRating, $el){
// make a server call here
}
});
option | default | description |
---|---|---|
totalStars | 5 | Amount of stars to show |
initialRating | 0 | Initial rating applied on load |
starSize | 40 | width in pixels of each star |
useFullStars | false | rate using whole stars, if enabled, it doesn't use half-steps |
emptyColor | lightgray | Color assigned to an empty star |
hoverColor | orange | Color assigned to hovered star |
activeColor | gold | Color assigned to active rated star |
useGradient | true | Active stars will use gradient coloring |
To use this option you need to populate the object [starGradient] | ||
starGradient | {start: '#FEF7CD', end: '#FF9511'} | Define the star and end colors for the gradient |
readOnly | false | If false any interaction is disabled |
disableAfterRate | true | Removes further events once a rate is selected |
strokeWidth | 0 | Defines the thickness of the border, 0 is disabled |
strokeColor | black | Defines the color for the border |
method | arguments | description |
---|---|---|
unload | Destroys the instance and removes events attached to it | |
setRating | 0 to max stars (int), round (Boolean) | Manually sets the rating |
getRating | Gets the current rating from instance |
// unload example
$('your-selector').starRating('unload')
// set rating example
$('your-selector').starRating('setRating', 2.5)
// set rating and round
$('your-selector').starRating('setRating', 2.8, true) // 3.0
// get rating example
$('your-selector').starRating('getRating')
name | arguments | description |
---|---|---|
callback | rating, DOM element | Executes when selecting a rate |
$('your-selector').starRating({
callback: function(currentRating, $el){
// do something after rating
}
});
method | description |
---|---|
onHover | executes a callback on mouseover |
onLeave | executes a callback on mouseout |
$('your-selector').starRating({
onHover: function(currentIndex, currentRating, $el){
// do something on mouseover
},
onLeave: function(currentIndex, currentRating, $el){
// do something after mouseout
}
});
Code example
Source file
Minified version
The MIT License (MIT)
FAQs
A star rating plugin based on svg
The npm package star-rating-svg receives a total of 710 weekly downloads. As such, star-rating-svg popularity was classified as not popular.
We found that star-rating-svg demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.