桂林一枝花 发表于 2017-4-13 14:00:37

分享一个视频的画面参数设置(进度条拖动控制)

<!DOCTYPE html>
<html lang="en">
    <head>
      <meta charset="utf-8">
    </head>
    <style>
      body{margin:0;padding:0;font-size:12px;background:#363936;}
      ul.lanren{width:245px;padding:0;margin:0;}
      .scale_panel{color:#999;width:140px;position:absolute;line-height:20px;left:0px;top:22px;}
      .scale_panel .r{float:right;}
      .scale span{ width:16px;height:16px;position:absolute;left:-2px;top:-5px;cursor:pointer;border-radius: 50%;background:#d6d6d6;}
      .scale{ background-repeat: repeat-x; background-position: 0 100%; background-color: #000; border-left: 1px #83BBD9 solid;width: 200px; height: 8px; position: relative; font-size: 0px; border-radius: 7px;-ms-border-radius:7px;}
      .scale div{ background-repeat: repeat-x; background-color: #858585; width: 0px; position: absolute; height: 8px; left: 0; bottom: 0; }
      .lanren li{font-size:12px;line-height:50px;position:relative;height:50px;list-style:none;}
      .number{ position: absolute;right: 0px;border: 1px solid #858585;width:30px;height: 20px;line-height: 20px;text-align: center;color:#fff;top:15px;}
      p{margin:0;padding:0; color:#fff;}
      h3{ color: #fff; }
    </style>
    <body>
      <h3>色彩调节</h3>
      <p>亮度</p>
      <ul class="lanren">
            <li>
                <div class="scale_panel">
                  <div class="scale" id="bar1">
                        <div></div>
                        <span id="btn1"></span>
                  </div>
                </div>
               <span id="title1" class="number">0</span>
            </li>
      </ul>

      <p>对比度</p>
      <ul class="lanren">
            <li>
                <div class="scale_panel">
                  <div class="scale" id="bar2">
                        <div></div>
                        <span id="btn2"></span>
                  </div>
                </div>
               <span id="title2" class="number">0</span>
            </li>
      </ul>      
          <p>饱和度</p>
         <ul class="lanren">
            <li>
                <div class="scale_panel">
                  <div class="scale" id="bar3">
                        <div></div>
                        <span id="btn3"></span>
                  </div>
                </div>
               <span id="title3" class="number">0</span>
            </li>
      </ul>
      <p>色调</p>
      <ul class="lanren">
            <li>
                <div class="scale_panel">
                  <div class="scale" id="bar4">
                        <div></div>
                        <span id="btn4"></span>
                  </div>
                </div>
               <span id="title4" class="number">0</span>
            </li>
      </ul>
    </body>
    <script>
            var scale = function (btn,bar,title){
            this.btn=document.getElementById(btn);
            this.bar=document.getElementById(bar);
            this.title=document.getElementById(title);
            this.step=this.bar.getElementsByTagName("div");
            this.init();
      };
      scale.prototype={
            init:function (){
                var f=this,g=document,b=window,m=Math;
                f.btn.onmousedown=function (e){
                  var x=(e||b.event).clientX;
                  var l=this.offsetLeft;
                  var max=f.bar.offsetWidth-this.offsetWidth;
                  g.onmousemove=function (e){
                        var thisX=(e||b.event).clientX;
                        var to=m.min(max,m.max(-2,l+(thisX-x)));
                        f.btn.style.left=to+'px';
                        f.ondrag(m.round(m.max(0,to/max)*100),to);
                        b.getSelection ? b.getSelection().removeAllRanges() : g.selection.empty();
                  };
                  g.onmouseup=new Function('this.onmousemove=null');
                };
            },
            ondrag:function (pos,x){
                this.step.style.width=Math.max(0,x)+'px';
                this.title.innerHTML=pos+'%';
            }
      }
      new scale('btn1','bar1','title1');
      new scale('btn2','bar2','title2');
      new scale('btn3','bar3','title3');
      new scale('btn4','bar4','title4');
    </script>
</html>

ibcadmin 发表于 2017-4-14 08:55:14

+1+1+1
页: [1]
查看完整版本: 分享一个视频的画面参数设置(进度条拖动控制)