2015-06-26 41 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>