Closed rui-figueiredo closed 9 years ago
No. You are not missing anything and I really appreciate that you point it out.
Tooltips for fractional (half or any number of fractions) is a functionality I had wanted to include some time ago when tooltips were introduced. To be fair I avoided to face it :wink:.
Now there are two new events associated to the symbols (rating.rateleave
and rating.rateenter
) that are triggered every time the highlighted rate is changed. You can use them to dynamically update the symbol tooltips.
<input type="hidden" class="rating-tooltip" data-filled="fa fa-star fa-3x" data-empty="fa fa-star-o fa-3x" data-fractions="2"/>
$('.rating-tooltip').rating({
extendSymbol: function () {
var title;
$(this).tooltip({
container: 'body',
placement: 'bottom',
trigger: 'manual',
title: function () {
return title;
}
});
$(this).on('rating.rateenter', function (e, rate) {
title = rate;
$(this).tooltip('show');
})
.on('rating.rateleave', function () {
$(this).tooltip('hide');
});
}
});
Hope it helps.
It helps a lot! Thank you, dreyescat :)
First of all, excellent plugin. Congratulations!
I do have one question/suggestion: is it possible to display half ratings in tooltips? When I enabled "half ratings", I only see integer numbers in the tooltips (example: "Rate 4") even though the half stars are being correctly displayed. Am I missing something?
Thanks in advance for any help.