Limit slider bubble position to its track
This commit is contained in:
parent
c4824abfb0
commit
e13e6f38d5
2 changed files with 7 additions and 2 deletions
|
@ -48,8 +48,13 @@ define(['browser', 'dom', 'layoutManager', 'keyboardnavigation', 'css!./emby-sli
|
|||
function updateBubble(range, value, bubble, bubbleText) {
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
var bubbleTrackRect = range.sliderBubbleTrack.getBoundingClientRect();
|
||||
var bubbleRect = bubble.getBoundingClientRect();
|
||||
|
||||
bubble.style.left = value + '%';
|
||||
var bubblePos = bubbleTrackRect.width * value / 100;
|
||||
bubblePos = Math.min(Math.max(bubblePos, bubbleRect.width / 2), bubbleTrackRect.width - bubbleRect.width / 2);
|
||||
|
||||
bubble.style.left = bubblePos + 'px';
|
||||
|
||||
if (range.getBubbleHtml) {
|
||||
value = range.getBubbleHtml(value);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue