我遇到問題。我想打一個全頁大小的背景,但我始終面臨着同樣的問題:滾動時固定背景結束
正如你可以看到我的網頁是高於100%,當我滾動加入我的背景ends.Background在DIV id=wrapper
這裏是我的代碼
HTML(JQ)的一部分:
<body>
<div id='wrapper'>
<!--content-->
</div>
<script>
$(document).ready(function() {
$('#wrapper').fadeIn(1000);
})
</script>
CSS:
html,body {
height:100%;
}
body {
min-height: 100%;
}
#wrapper {
background: url(../bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height:100%;
display:none;
background-attachment: fixed;
}
我正在尋找答案,並閱讀了Stackoverflow中的問題(f.e。 https://stackoverflow.com/a/6654996/3726786)但沒有什麼幫助。謝謝你的幫助!
嗨的用戶,首先歡迎,你有一個小提琴或鏈接的例子嗎? – dutchsociety
您是否需要身體的html,body,#wrapper和'min-height:100%'這些'height:100%'聲明?如果你刪除它們,它會起作用。 – vbulant
@dutchsociety https://jsfiddle.net/jv0ygnzq/這裏:)類似的東西 – user3726786