mirror of
https://github.com/videojs/video.js.git
synced 2024-12-12 11:15:04 +02:00
Fix slider for android
This commit is contained in:
parent
cbcff6a168
commit
85df20d736
9
src/js/controls.js
vendored
9
src/js/controls.js
vendored
@ -612,7 +612,8 @@ vjs.Slider.prototype.calculateDistance = function(event){
|
||||
var box = this.el_,
|
||||
boxX = vjs.findPosX(box),
|
||||
boxW = box.offsetWidth,
|
||||
handle = this.handle;
|
||||
handle = this.handle,
|
||||
pageX = event.pageX;
|
||||
|
||||
if (handle) {
|
||||
var handleW = handle.el().offsetWidth;
|
||||
@ -622,8 +623,12 @@ vjs.Slider.prototype.calculateDistance = function(event){
|
||||
boxW = boxW - handleW;
|
||||
}
|
||||
|
||||
if (pageX === 0 && event.changedTouches) {
|
||||
pageX = event.changedTouches[0].pageX;
|
||||
}
|
||||
|
||||
// Percent that the click is through the adjusted area
|
||||
return Math.max(0, Math.min(1, (event.pageX - boxX) / boxW));
|
||||
return Math.max(0, Math.min(1, (pageX - boxX) / boxW));
|
||||
};
|
||||
|
||||
vjs.Slider.prototype.onFocus = function(){
|
||||
|
@ -172,6 +172,11 @@ vjs.fixEvent = function(event) {
|
||||
event[prop] = old[prop];
|
||||
}
|
||||
|
||||
if (event.changedTouches && event.pageX === 0 && event.pageY === 0) {
|
||||
event.pageX = event.changedTouches[0].pageX;
|
||||
event.pageY = event.changedTouches[0].pageY;
|
||||
}
|
||||
|
||||
// The event occurred on this element
|
||||
if (!event.target) {
|
||||
event.target = event.srcElement || document;
|
||||
|
Loading…
Reference in New Issue
Block a user