css3滑块自动旋转

时间:2013-03-25 20:02:58

标签: css3

我有一个手风琴滑块。哪个使用CSS3是一种让滑块自动旋转而不使用jquery而只使用纯css3动画的方法? Here is the URL to my site.

1 个答案:

答案 0 :(得分:2)

喜欢这个吗?

http://jsfiddle.net/coma/bXDHE/30/

<强> HTML

<div class="neat">
    <div>
        <img src="http://www.menucool.com/slider/prod/image-slider-4.jpg"/>
        <img src="http://blogs.mathworks.com/pick/files/zebrainpastelfield.png"/>
        <img src="http://www.freewarepocketpc.net/wp7/img/image-effecter-free.png"/>
        <img src="http://www.poyraz.gen.tr/wp-content/uploads/images_4781_1.jpg"/>
    </div>
</div>

<强> CSS

div.neat {
    font-size: 500px;
    width: 1em;
    height: 200px;
    overflow: hidden;
}

div.neat > div {
    position: relative;
    left: 0;
    width: 4em;
    -webkit-animation: loop 10s infinite;
    -moz-animation: loop 10s infinite;
}

div.neat > div > img {
    width: 1em;
    display: block;
    float: left;
}

@-webkit-keyframes loop {
    0% { left: 0; }
    20% { left: 0; }
    25% { left: -1em; }
    45% { left: -1em; }
    50% { left: -2em; }
    70% { left: -2em; }
    75% { left: -3em; }
    95% { left: -3em; }
}

@-moz-keyframes loop {
    0% { left: 0; }
    20% { left: 0; }
    25% { left: -1em; }
    45% { left: -1em; }
    50% { left: -2em; }
    70% { left: -2em; }
    75% { left: -3em; }
    95% { left: -3em; }
}