# During the movement of the stars to add fractional values?

April 19th 20 at 12:05
April 19th 20 at 12:07
Solution
Fix sections:
``````if ( ( exitPointY >= topEdge ) && ( exitPointY <= bottomEdge ) && ( exitPointX > (leftEdge + reasonableWidth) ) ) {
\$('#param' + id).text("5.0");``````

``````var rating = progress * 5 / width;
rating = Math.max(Math.ceil(rating), 1);

\$('#param' + id).text(Math.ceil(rating).toFixed(1));``````
@Winona, thank you very much
a caveat

and if you need to and 0 easy to use?
remove 72-76 line
but also - Bailee45 commented on April 19th 20 at 12:10
@Bailee45,
edit
``````if (e.pageX < leftEdge) {
progress = 0;
} else if (e.pageX >= rightEdge) {
progress = obj.width();
}

var rating = progress * 5 / width;
// less than half of the stars
rating = rating < 0.5 ? 0 : Math.max(Math.ceil(rating), 1);``````

and
``````\$("#rating #rating-overlay").on('mousemove', function(e) {
let width = \$(this).width();
let left = \$(this).offset().left;
let goPercentage = (e.clientX - left)/width * 100;
//goPercentage = Math.max(Math.ceil(goPercentage/20)*20, 20);
// less than half of the first star
goPercentage = goPercentage < 10 ? 0 : Math.max(Math.ceil(goPercentage/20)*20, 20);

let startPercentage = 100 - goPercentage;

function constrain(n, min, max) {
return Math.max(Math.min(n, max), min);
}
// don't need
//if (goPercentage === 0){
//\$('.stars__count').text('0.0')
//goPercentage = 20;
//constrain(+\$('.stars__count').text(), 1, 5);
//}``````
- Winona commented on April 19th 20 at 12:13
@Bailee45, write? structure is too complicated for this task I think - Winona commented on April 19th 20 at 12:16
@Winonaherself
and as for the other? like not really complicate - Bailee45 commented on April 19th 20 at 12:19
@Bailee45, for example (not a coder and not pretender, therefore not to blame for crossbrowser TSSS) - Winona commented on April 19th 20 at 12:22
@Winona, thank you
You backender?) - Bailee45 commented on April 19th 20 at 12:25
@Bailee45, too, by))) - Winona commented on April 19th 20 at 12:28
@Winona, difficult to guess))
Manager? - Bailee45 commented on April 19th 20 at 12:31
@Bailee45, you can not guess with this move the proposed options - Winona commented on April 19th 20 at 12:34

Find more questions by tags jQueryJavaScript