dreyescat / bootstrap-rating

Bootstrap Rating is a jQuery plugin that creates a rating control that uses Bootstrap glyphicons for rating symbols.
http://dreyescat.github.io/bootstrap-rating/
MIT License
192 stars 78 forks source link

Issue with multiple ratings on iOS devices #32

Open BoussonNicolas opened 6 years ago

BoussonNicolas commented 6 years ago

On any iOS device, I have a problem with multiple ratings. For example I can choose 3 stars for the first rating. When I try to select 4 stars in the next row, it modifies somehow randomly the rating from the previous row! After investigating a bit, it seems the rating value is not updated everytime wrt to the number of stars displayed, especially when the touch is at the border of the rate symbols... The plugin works perfectly on Android and desktop.

Harekam commented 6 years ago

any update on this?

BoussonNicolas commented 6 years ago

Yes I've fixed it adding the following code to bootstrap-rating.js:

var index;
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
var start_evt = 'mousedown touchstart', move_evt = 'mousemove touchmove', end_evt='mouseleave touchend';
if (iOS){
     start_evt = 'touchstart';
     move_evt = 'touchmove';
     end_evt = 'touchend';
}
$rating
.on(start_evt, '.rating-symbol', ifEnabled(function (e) {
...