2012-02-23 50 views
3

所以我想創建一個視差風格的網站很像this one.然而,雖然他們使用背景圖像與'固定'附件的圖像效果不移動,我想要使用jQuery幻燈片插件。基本上,如果我的圖像包含在滑塊中,如何實現「固定」附件和背景位置?目前在幻燈片中的圖像剛剛滾動...沒有使用背景附件的視差效果:固定

我很樂意爲您提供代碼樣本削減沿途

由於需要任何進一步的信息!

+1

嘿romboards,請你接受ScottS的回答。我有同樣的問題,他的解決方案完全適合。 – jnns 2014-03-11 09:22:34

回答

6

像這樣的東西應該工作(只是示例代碼[使用語義的id):

<div id="SlideShowContainer">Slide Show Generates into this div</div> 
<div id="AllOtherContentWrapper">All other content goes here</div> 

然後設置CSS來:

#SlideShowContainer { 
    position: fixed; 
    z-index: 0; 
    top: 0; right: 0; bottom: 0; left: 0; 
} 

#AllOtherContentWrapper { 
    position: relative; /* this could be absolute depending on application*/ 
    z-index: 1; 
} 

這應該使幻燈片放映等於容器當前的屏幕大小,並修復它(基本上就像一個固定的背景)。然後,該網站的其他部分將放在其他div的幻燈片放映之上。