External resources loaded into this fiddle:
<h4>Rate it!</h4>
<div id="rate_it" class="star-rating"></div>
<h4>It has 4 stars. Aggree?</h4>
<div id="rate_it2" class="star-rating" data-score="4"></div>
jQuery(function () {
$('#rate_it').awesomeStarRating({
onChange: function (score) {
if(score > 3) {
alert('Awesome! You give it ' + score + ' stars!');
} else if ( score > 1 ) {
alert('You give it ' + score + ' stars. That\'s ok :-)');
} else {
alert('Oh... just one star? Really?');
}
}
});
$('#rate_it2').awesomeStarRating();
});
.star-rating i {
margin-right: 0.2em;
font-size: 16px;
cursor: pointer;
}
.star-rating .fa-star, .star-rating .fa-star-half-o {
color: #f8a000;
}
.star-rating .fa-star-o {
color: #cccccc;
}