scripts/jquery.rateit.js
function (element, event) {
                var pageX = (event.changedTouches) ? event.changedTouches[0].pageX : event.pageX;

                var offsetx = pageX - $(element).offset().left;
                if (!ltr) { offsetx = range.width() - offsetx };
                if (offsetx > range.width()) { offsetx = range.width(); }
                if (offsetx < 0) { offsetx = 0; }

                return score = Math.ceil(offsetx / itemdata('starwidth') * (1 / itemdata('step')));
            }
function (element, event) {
                var pageX = (event.changedTouches) ? event.changedTouches[0].pageX : event.pageX;

                var offsetx = pageX - $(element).offset().left;
                if (!ltr) { offsetx = range.width() - offsetx };
                if (offsetx > range.width()) { offsetx = range.width(); }
                if (offsetx < 0) { offsetx = 0; }

                return score = Math.ceil(offsetx / itemdata('starwidth') * (1 / itemdata('step')));
            }
function ( element , event ) { var pageX = ( event . changedTouches ) ? event . changedTouches [ 0 ] . pageX : event . pageX ; var offsetx = pageX - $ ( element ) . offset ( ) . left ; if ( ! ltr ) { offsetx = range . width ( ) - offsetx } ; if ( offsetx > range . width ( ) ) { offsetx = range . width ( ) ; } if ( offsetx < 0 ) { offsetx = 0 ; } return score = Math . ceil ( offsetx / itemdata ( 'starwidth' ) * ( 1 / itemdata ( 'step' ) ) ) ; }
this function calculates the score based on the current position of the mouse.
this function calculates the score based on the current position of the mouse .