css+js自己实现video视频的control控制器及样式自定义效果代码

代码语言:html

所属分类:多媒体

代码描述:css+js自己实现video视频的control控制器及样式自定义效果代码

代码标签: css js video 视频 control 控制器 样式 自定义

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">

      <link
      rel="stylesheet"
      href="https://use.fontawesome.com/releases/v5.7.0/css/all.css"
      integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ"
      crossorigin="anonymous"
    />
  
  
  
<style>
* {
  box-sizing: border-box;
  margin: 0;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background-color: black;
  max-height: 100vh;
}

video {
  cursor: pointer;
  width: 85vw;
  max-width: 600px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  border: solid 1px rgb(134, 134, 134);
  border-bottom: 0;
  margin-top: 20px;
}

.controls {
  width: 85vw;
  max-width: 600px;
  background-color: #52134b;
  padding: 5px;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: solid 1px rgb(134, 134, 134);
  border-top: 0;

  margin-bottom: 20px;
}

.controls .btn {
  height: 25px;
  width: 25px;
  background-color: transparent;
  border: 0;
  color: white;
  cursor: pointer;
  transition: 0.4s;
}
.controls .btn:hover {
  color: #fccf23;
  transition: 0.4s;
}

.controls .btn:focus {
  outline: 0;
}

.controls span {
  color: white;
  margin-left: 6px;
}


/*progress bar*/
input[type='range'] {
  -webkit-appearance: none; /* Hides the slider so that custom slider can be made */
  width: 100%; /* Specific width is required for Firefox. */
  background: transparent; /* Otherwise white in Chrome */
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
}

input[type='range']:focus {
  outline: none; /* Removes the blue border. You should probably do some kind of focus styling for accessibility reasons though. */
}

input[type='range']::-ms-track {
  width: 100%;
  cursor: pointer;

  /* Hides the slider so custom styles can be added */
  background: transparent;
  border-color: transparent;
  color: transparent;
}

/* Special styling for WebKit/Blink */
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  border: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #fccf23;
  cursor: pointer;
  margin-top: -4px; /* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
  box-shadow: 1px 2px 10px #000000;
}

/* All the same stuff for Firefox */
input[type='range']::-moz-range-thumb {
  box-shadow: 1px 2px 10px #000000;
  border: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #fccf23;
  cursor: pointer;
}

/* All the same stuff for IE */
input[type='range']::-ms-thumb {
  box-shadow: 1px 2px 10px #000000;
  border: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: #fccf23;
  cursor: pointer;
}

input[type='range']::-webkit-slider-runnable-track {
  width: 100%;
  height: 8.4px;
  cursor: pointer;
  background: white;
  border-radius: 4px;
  border: 0;
  margin-left: 8px;
}

input[type='range']:focus::-webkit-slider-runnable-track {
  background: #faf17b;
}

input[type='range']::-moz-range-track {
  width: 100%;
  height: 8.4px;
  cursor: pointer;
  background: white;
  border-radius: 4px;
  border: 0;
  margin-left: 8px.........完整代码请登录后点击上方下载按钮下载查看

网友评论0