模糊按钮上的页面背景单击



我一直在寻找一种解决方案,当用户单击按钮时,它会模糊我现有的CSS3背景。

目前HTML是这样的:

<div class="button">
    <li><a href="#" alt="fade button">Start Now</a></li>
</div>

CSS是:

html, body { margin:0px; padding: 0px; background: url(../assets/background.png) no-repeat center center fixed;  -webkit-background-size: cover; -moz-background-size: cover;  -o-background-size: cover; background-size: cover;}
.button { 
    vertical-align: middle;
    width:150px; 
    margin: 0 auto;  
    margin-top:200px;
    background-color:#81DF7B;
    padding:10px;
    border-radius: 5px;
    text-decoration: none;
    color:#333;
    font-weight:300;
    font-size: 1.3em;
    -webkit-transition: background-color 0.3s ease-in-out 0s;
    -moz-transition: background-color 0.3s ease-in-out 0s;
    -o-transition: background-color 0.3s ease-in-out 0s;
    -ms-transition: background-color 0.3s ease-in-out 0s;
    transition: background-color 0.3s ease-in-out 0s;
}
.button:hover{ 
    background-color: #00CC33; 
    cursor:pointer;
}
.button li {padding:20px; text-align:center; text-decoration: none; list-style: none; }
.button li a {text-decoration: none;}

正如您所看到的,背景图像作为CSS3封面图像附加到html和body中。

我想要的是,当用户点击"立即开始"按钮时,背景会平滑地转换为模糊,这样隐藏的表单字段就可以清晰地显示在顶部。

我一直在研究blur.js和Jquery blur,但无法找到实现这一点的最佳方法。

如有任何建议,我们将不胜感激:)

您可以为该按钮的onclick事件实现这样的css。

.background {     
-webkit-filter: blur(10px);     
filter: blur(10px);      
}

最新更新