diff --git a/src/speed/speed.css b/src/speed/speed.css index 76579a8..49b8cf7 100644 --- a/src/speed/speed.css +++ b/src/speed/speed.css @@ -1,3 +1,7 @@ +.mejs__speed-selector.mejs__offscreen { + display: none; +} + .mejs__speed-button, .mejs-speed-button { position: relative; @@ -24,15 +28,9 @@ padding: 0; position: absolute; top: -100px; - visibility: hidden; width: 60px; } -.mejs__speed-selector, -.mejs-speed-selector { - visibility: visible; -} - .mejs__speed-selector-list, .mejs-speed-selector-list { display: block; @@ -45,6 +43,7 @@ .mejs__speed-selector-list-item, .mejs-speed-selector-list-item { color: #fff; + border: 0.06rem solid transparent; display: block; list-style-type: none !important; margin: 0 0 6px; @@ -58,6 +57,11 @@ background-color: rgba(255, 255, 255, 0.4) !important; } +.mejs__speed-selector-list-item:focus-within, +.mejs-speed-selector-list-item:focus-within { + border-color: #fff; +} + .mejs__speed-selector-input, .mejs-speed-selector-input { clear: both; @@ -82,13 +86,4 @@ .mejs__speed-selected, .mejs-speed-selected { color: rgba(33, 248, 248, 1); -} - -.mejs__speed-selector, -.mejs-speed-selector { - visibility: hidden; -} -.mejs__speed-button:hover .mejs__speed-selector, -.mejs-speed-button:hover .mejs-speed-selector { - visibility: visible; -} +} \ No newline at end of file diff --git a/src/speed/speed.js b/src/speed/speed.js index 663f420..81011bf 100644 --- a/src/speed/speed.js +++ b/src/speed/speed.js @@ -71,7 +71,7 @@ Object.assign(MediaElementPlayer.prototype, { // And always include the defaultSpeed { const length = t.options.speeds.length; - for(let i = 0; i < length; i++) { + for (let i = 0; i < length; i++) { const speed = t.options.speeds[i]; if (typeof speed === 'string') { @@ -114,13 +114,15 @@ Object.assign(MediaElementPlayer.prototype, { // Build up the main button and the
next to it within the player bar. { - player.speedButton = document.createElement('div'); - player.speedButton.className = `${t.options.classPrefix}button ${t.options.classPrefix}speed-button`; + player.speedContainer = document.createElement('div'); + player.speedContainer.className = `${t.options.classPrefix}button ${t.options.classPrefix}speed-button`; + + const generateId = Date.now() + '.' + Math.floor(Math.random() * 100); - player.speedButton.innerHTML = + player.speedContainer.innerHTML = '