我有具有用於身體三個不同的圖像和我有一個JavaScript函數改變所述類在這樣身體背景圖像幻燈片過渡,而不是衰落
function bgchange()
{
document.body.className = 'intro2';
setTimeout(bgchange2, 3000);
}
和三類各自具有間不同的背景是這樣的
.intro {
background: url('../img/home-bg.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
-webkit-transition: background 300ms ease-in 200ms;
-moz-transition: background 300ms ease-in 200ms;
-o-transition: background 300ms ease-in 200ms;
transition: background 300ms ease-in 200ms;
}
.intro2 {
background: url('../img/home-bg2.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
-webkit-transition: background 300ms ease-in 200ms;
-moz-transition: background 300ms ease-in 200ms;
-o-transition: background 300ms ease-in 200ms;
transition: background 300ms ease-in 200ms;
}
這給了我一個淡出過渡,但不是淡出過渡我要向上滑動的效果,同時新類IMG出現下面,我想一切從CSS背景位置來使用JavaScript但我無法確定它出來了,有什麼幫助?
您將不得不使用動畫而不是轉換。 – taxicala
你可以撥弄它嗎 – Gacci
你是否必須使用背景或者你可以使用div中的圖像! – Gacci