【问题标题】:how to blur the background video of the targeted div?如何模糊目标div的背景视频?
【发布时间】:2016-02-09 14:17:32
【问题描述】:

我意识到有很多关于如何使背景图像模糊的问题,但我想知道是否可以使用 css 或 jquery(blur js) 插件来模糊目标 div 的背景视频。

https://www.npmjs.com/package/blur-js

目前,该插件仅支持 .body 源,因此除了将我想要模糊的图像插入“body”的背景之外,没有其他方法可以定位任何其他 div

或者,作为第二种方法,如果我使用这个 js 插件提供滤镜模糊 http://nbartlomiej.github.io/foggy/

它会模糊文本,而不是图层的背景。

看看它如何模糊文本,而不是背景。

http://imgur.com/1J4W5Yu

谁能帮我弄清楚如何模糊背景视频?

这是我的网站,其中包含移动视频。谢谢。

http://lifeto.cafe24.com/xe/index.php?mid=today

【问题讨论】:

    标签: javascript jquery html css


    【解决方案1】:

    body{
      padding:0;
      margin:0;
    }
    .vid-container{
      position:relative;
      height:100vh;
      overflow:hidden;
    }
    .bgvid{
      position:absolute;
      left:0;
      top:0;
      width:100vw;
    }
    .inner-container{
      width:400px;
      height:400px;
      position:absolute;
      top:calc(50vh - 200px);
      left:calc(50vw - 200px);
      overflow:hidden;
    }
    .bgvid.inner{
      top:calc(-50vh + 200px);
      left:calc(-50vw + 200px);
      filter: url("data:image/svg+xml;utf9,<svg%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'><filter%20id='blur'><feGaussianBlur%20stdDeviation='10'%20/></filter></svg>#blur");
      -webkit-filter:blur(10px);
      -ms-filter: blur(10px);
      -o-filter: blur(10px);
      filter:blur(10px);
    }
    .box{
      position:absolute;
      height:100%;
      width:100%;
      font-family:Helvetica;
      color:#fff;
      background:rgba(0,0,0,0.13);
      padding:30px 0px;
    }
    .box h1{
      text-align:center;
      margin:30px 0;
      font-size:30px;
    }
    .box input{
      display:block;
      width:300px;
      margin:20px auto;
      padding:15px;
      background:rgba(0,0,0,0.2);
      color:#fff;
      border:0;
    }
    .box input:focus,.box input:active,.box button:focus,.box button:active{
      outline:none;
    }
    .box button{
      background:#2ecc71;
      border:0;
      color:#fff;
      padding:10px;
      font-size:20px;
      width:330px;
      margin:20px auto;
      display:block;
      cursor:pointer;
    }
    .box button:active{
      background:#27ae60;
    }
    .box p{
      font-size:14px;
      text-align:center;
    }
    .box p span{
      cursor:pointer;
      color:#666;
    }
    <div class="vid-container">
      <video class="bgvid" autoplay="autoplay" muted="muted" preload="auto" loop>
          <source src="http://mazwai.com/system/posts/videos/000/000/109/webm/leif_eliasson--glaciartopp.webm?1410742112" type="video/webm">
      </video>
        <div class="box">
          <h1>Login</h1>
          <input type="text" placeholder="Username"/>
          <input type="text" placeholder="Password"/>
          <button>Login</button>
          <p>Not a member? <span>Sign Up</span></p>
        </div>
      </div>
    </div>

    【讨论】:

    • 嗯...我什么都没看到??!
    猜你喜欢
    • 2017-01-11
    • 2018-04-24
    • 2017-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-24
    • 2015-03-31
    相关资源
    最近更新 更多