简体   繁体   English

Firefox进度条样式

[英]Firefox progress bar style

I have a problem with HTML video player progress bar style in Firefox. 我在Firefox中使用HTML视频播放器进度栏样式时遇到问题。 Safari and Chrome are okay, but Firefox is completely different. Safari和Chrome都可以,但是Firefox完全不同。 There should be no "bubble" and only the progress bar border is with the right colour. 不应有“气泡”,只有进度条边框的颜色正确。 Anyone have idea how to get rid of the bubble and fill the bars background? 有人知道如何消除气泡并填充条形图背景吗?

Firefox: Firefox:

火狐浏览器

Chrome: 铬:

铬

Safari: 苹果浏览器:

苹果浏览器

HTML: HTML:

<div id="progress">
            <input type="range" id="seek-bar" min="0" max="100"  value="0" class="range" />
</div>

CSS: CSS:

.range {
  -webkit-appearance: none;
  background: linear-gradient(to right,
    #444 0, #444 100%);
  cursor: pointer;
  height: 3px;
  margin: 0;
  transitionx: 0.1s ease-in;
  vertical-align: bottom;
  width: 100%;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
}


#video-controls:hover .range::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
}

JS: JS:

      // Update the seek bar as the video plays
        video.addEventListener("timeupdate", function () {
      // Calculate the slider value
        var value = (100 / video.duration) * video.currentTime;
      // Update the slider value
        seekBar.value = value;
        updateText(video.currentTime);
        $current.text((new Date(null, null, null, null, null, video.currentTime).toTimeString().match(/\d{2}:\d{2}:\d{2}/)[0]).substr(3)); //Update current time MM:ss
        var $seekBar = $("#seek-bar");
        var val = $seekBar.val(); // Current video position
        var buf = (video.buffered.end(0) / video.duration) * 100; // Calculates buffered %
        $seekBar.css('background', 'linear-gradient(to right, #ff9900 0%, #ff9900 ' + val + '%, #777 ' + val + '%, #777 ' + buf + '%, #444 ' + buf + '%, #444 100%)');
    });

Here are some styles for Firefox range input psuedo-elements, which should let you change the defaults for the thumb(bubble) and the track: 以下是Firefox范围输入psuedo-elements的一些样式,应使用这些样式来更改thumb(bubble)和track的默认设置:

.range{
    padding:0;
    background: linear-gradient(to right, #444 0, #444 100%);
}
.range::-moz-range-track {
    background: linear-gradient(to right, #444 0, #444 100%);
    border: none;
}
.range::-moz-range-thumb {
    background: rgba(0,0,0,0); /*hide the 'bubble'*/
}

.range::-moz-focusring{ /*hide the outline behind the border*/
    outline: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM