通过CSS3像Cycle一样滑动

时间:2012-11-23 15:27:13

标签: jquery css css3

我有这个结构。

HTML:

<div id="sequence">
            <img class="prev" src="themes/bc/imagesx/bt-prev.png" alt="Previous" />
            <img class="next" src="themes/bc/imagesx/bt-next.png" alt="Next" />
            <ul>
                <li>
                    <div class="info animate-in">
                        <h2>Built using Sequence.js</h2>
                        <p>The Responsive Slider with Advanced CSS3 Transitions</p>
                    </div>
                    <img class="sky animate-in" src="themes/bc/imagesx/bg-clouds.png" alt="Blue Sky" />
                    <img class="balloon animate-in" src="themes/bc/imagesx/balloon.png" alt="Balloon" />
                </li>
                <li>
                    <div class="info">
                        <h2>Creative Control</h2>
                        <p>Create unique sliders using CSS3 transitions -- no jQuery knowledge required!</p>
                    </div>
                    <img class="sky" src="themes/bc/imagesx/bg-clouds2.png" alt="Blue Sky" />
                    <img class="aeroplane" src="themes/bc/imagesx/aeroplane.png" alt="Aeroplane" />
                </li>
                <li>
                    <div class="info">
                        <h2>Cutting Edge</h2>
                        <p>Supports modern browsers, old browsers (IE7+), touch devices and responsive designs</p>
                    </div>
                    <img class="sky" src="themes/bc/imagesx/bg-clouds3.png" alt="Blue Sky" />
                    <img class="kite" src="themes/bc/imagesx/kite.png" alt="Kite" />
                </li>
            </ul>
        </div>

CSS:

.sky {
    width: 100%;
    right: -100%;
    opacity: 1;
    top: auto;
    bottom:-25px;
    vertical-align: middle;

    -webkit-transition-property: left top;
    -moz-transition-property: left top;
    -o-transition-property: left top;
    -ms-transition-property: left top;
    transition-property: left top;
    z-index: 1;
}

.sky.animate-in {
    right: 0%;
    opacity: 1;
    top: auto;
    bottom:-25px;

    -webkit-transition-duration: 4s;
    -moz-transition-duration: 4s;
    -o-transition-duration: 4s;
    -ms-transition-duration: 4s;
    transition-duration: 4s;

    -webkit-transition-property: left top;
    -moz-transition-property: left top;
    -o-transition-property: left top;
    -ms-transition-property: left top;
    transition-property: left top;
    z-index: 1;
    ransition-timing-function: ease;
-moz-transition-timing-function: ease; /* Firefox 4 */
-webkit-transition-timing-function: ease; /* Safari and Chrome */
-o-transition-timing-function: ease; /* Opera */

}

.sky.animate-out {
    right: 100%;
    opacity: 1;
    top: auto;
    bottom:-25px;

    -webkit-transition-duration: 4s;
    -moz-transition-duration: 4s;
    -o-transition-duration: 4s;
    -ms-transition-duration: 4s;
    transition-duration: 4s;

    -webkit-transition-property: left top;
    -moz-transition-property: left top;
    -o-transition-property: left top;
    -ms-transition-property: left top;
    transition-property: left top;
    z-index: 1;
    transition-timing-function: ease;
-moz-transition-timing-function: ease; /* Firefox 4 */
-webkit-transition-timing-function: ease; /* Safari and Chrome */
-o-transition-timing-function: ease; /* Opera */
}

我正在使用Sequence JS插件。一切正常。但我希望bgclouds和bgclouds2不要分离过渡。它同时开始,同时完成。但现在,顺利。

我可以通过CSS3制作该结构吗? http://css3.bradshawenterprises.com/sliding/单击图像2时,转到image1并直接启动image2。

对不起我的表达。请帮帮我。

1 个答案:

答案 0 :(得分:0)

您可能想要调查CSS中的@keyframes。这些允许您设置项目在动画中开始和停止的时间。