2013-01-07 169 views
0

好吧,我正在尝试制作纯粹的CSS3图片幻灯片。 (是的,我知道使用JQuery可以更简单。)我无法在浏览器中使用它,因此我还没有为其他浏览器添加语法。CSS3动画中的延迟

我的HTML是...

  <div class="slide-show"> 
       <img src="pictures/slide-1.jpg" alt="Broken Earth" class="slide-1"/> 
       <img src="pictures/slide-2.jpg" alt="World Map" class="slide-2"/> 
       <img src="pictures/slide-3.jpg" alt="Sunset" class="slide-3"/> 
       <img src="pictures/slide-4.jpg" alt="Ursumian Flag" class="slide-4"/> 
      </div> 

我的CSS是...

.slide-show { 

    border-style: solid; 
    border-width: 3px; 
    border-color: #746d27; 
    overflow: visible; 
    width: 600px; 
    height: 300px; 
    position: relative; 
    margin-left: auto; 
    margin-right: auto; 
    top: 30px; 

} 

.slide-1 { 

    position: relative; 
    -webkit-animation-name: one; 
    -webkit-animation-duration: 20s; 
    -webkit-animation-timing-function: linear; 
    -webkit-animation-iteration-count: infinite; 
    -webkit-animation-play-state: running; 
    width: 600px; 
    height: 300px; 

} 

.slide-2 { 

    position: relative; 
    -webkit-animation-name: two; 
    -webkit-animation-duration: 20s; 
    -webkit-animation-timing-function: linear; 
    -webkit-animation-iteration-count: infinite; 
    -webkit-animation-play-state: running; 
    width: 600px; 
    height: 300px; 

} 

.slide-3 { 

    position: relative; 
    -webkit-animation-name: three; 
    -webkit-animation-duration: 20s; 
    -webkit-animation-timing-function: linear; 
    -webkit-animation-iteration-count: infinite; 
    -webkit-animation-play-state: running; 
    width: 600px; 
    height: 300px; 

} 

.slide-4 { 

    position: relative; 
    -webkit-animation-name: four; 
    -webkit-animation-duration: 20s; 
    -webkit-animation-timing-function: linear; 
    -webkit-animation-iteration-count: infinite; 
    -webkit-animation-play-state: running; 
    width: 600px; 
    height: 300px; 

} 

@-webkit-keyframes one { 

    0% {left: 0px; top: 0px;} 
    15% {left: 0px; top: 0px;} 
    20% {left: 600px; top: 0px;} 
    21% {left: 600px; top: 300px;} 
    22% {left: -600px; top: 300px;} 
    23% {left: -600px; top: 0px;} 
    95% {left: -600px; top: 0px;} 
    100% {left: 0px; top: 0px;} 

} 

@-webkit-keyframes two { 

    0% {left: -600px; top: -305px;} 
    15% {left: -600px; top: -305px;} 
    20% {left: 0px; top: -305px;} 
    35% {left: 0px; top: -305px;} 
    40% {left: 600px; top: -305px;} 
    41% {left: 600px; top: -5px;} 
    42% {left: -600px; top: -5px;} 
    43% {left: -600px; top: -305px;} 
    100% {left: -600px; top: -305px;} 

} 

@-webkit-keyframes three { 

    0% {left: -600px; top: -610px;} 
    35% {left: -600px; top: -610px;} 
    40% {left: 0px; top: -610px;} 
    55% {left: 0px; top: -610px;} 
    60% {left: 600px; top: -610px;} 
    61% {left: 600px; top: -310px;} 
    62% {left: -600px; top: -310px;} 
    63% {left: -600px; top: -610px;} 
    100% {left: -600px; top: -610px;} 

} 

@-webkit-keyframes four { 

    0% {left: -600px; top: -915px;} 
    55% {left: -600px; top: -915px;} 
    60% {left: 0px; top: -915px;} 
    75% {left: 0px; top: -915px;} 
    80% {left: 600px; top: -915px;} 
    81% {left: 600px; top: -615px;} 
    82% {left: -600px; top: -615px;} 
    83% {left: -600px; top: -915px;} 
    100% {left: -600px; top: -915px;} 

} 

通知, “幻灯片放映” 类不具有 “溢出” 设置为“可见。 “这样我就可以确保所有图像都正确移动。当他们这样做时,这将被切换到“隐藏”。共有4张照片,每张只能在舞台上进出舞台总共2秒,每人应该花3秒时间坐在舞台上。为什么我在上一张幻灯片中有滞后?

+0

你能添加一个链接到页面吗? – Fabio

回答

0

不要只用-webkit-,再添一为每一个“风格”,不-webkit-

此外,您还可以提供一个演示?

+0

http://testportfolio.bugs3.com/ 将它放在测试服务器上。我知道关于“-webkit-”的东西。我只是试图让它工作,然后再添加更多的代码,并使其更容易混淆。 – Allenph

+0

它不落在我的身上,哪一部分我应该看到滞后? – user1254290

+0

第一张幻灯片没有及时返回原始位置。不知何故,我的时机错了。它应该是一个无缝循环的图片。 – Allenph