2015-06-26 40 views
0

我在jQuery Mobile中使用了固定标题。我可以很容易地通过使用e.g建立一个透明的报头:jQuery Mobile磨砂标题

background-color: rgba(255, 255, 255, 0.8); 

作为页面向上移动和头下,它可以通过报头中可以看出。

我想要的是通过标题看到的页面模糊,即“磨砂玻璃”效果。

只是把,例如:

filter:blur(5px); 

到页眉,模糊的一切头,但不模糊所看到通过头。我不想模糊标题中的内容。

是否有一个简单的单行程或左右,以获得jQuery Mobile中的磨砂玻璃标题?这将是巨大的,如果创建第二个div作为头内容和模糊它,就像你想它是作为例如为:

background-color: rgba(255, 255, 255, 0.8), blur(5px); 
+0

您可以创建头下方的另一个div来包含毛玻璃效果。 – FiringSquadWitness

+1

我想我原来的问题并不清楚。我已编辑它以反映模糊内容*在*标题不是我想要的。 – Aaron

回答

0

一样简单。

.header { 
 
    background-color: rgba(220, 220, 220, 0.8); 
 
    width: 100%; 
 
    height: 80px; 
 
} 
 
.header-content { 
 
    width:100%; 
 
    height: 100%; 
 
    -webkit-filter: blur(1px); 
 
    -moz-filter: blur(1px); 
 
    -o-filter: blur(1px); 
 
    -ms-filter: blur(1px); 
 
    filter: blur(1px); 
 
    background-color: #fafafa; 
 
}
<div class="header"> 
 
    <div class="header-content">Test test test test test test test</div> 
 
</div>

0

Demo

CSS

body, html { 
    margin: 0; 
    padding: 0; 
} 
header { 
    position: relative; 
    height: 50px; 
    overflow: hidden; 
    text-align: center; 
} 
header:before { 
    content: ""; 
    position: absolute; 
    top: 0; 
    bottom: 0; 
    left: 0; 
    right: 0; 
    background: rgba(255,0,0,0.5); 
    -webkit-filter: blur(5px); 
    z-index: -1; 
} 

HTML

<header>this is header</header>