纯css3图像滑块

时间:2013-12-16 03:51:36

标签: html5 css3

我需要使用纯css3制作图像滑块而不使用任何jquery。我刚试了这个

    #content-slider {
    font-family: arial;
    width: 640px;
    margin: 0 auto;
    margin-top: 10px;
}

#content {
    overflow: hidden;
    width: 640px;
    height: 480px;
    -webkit-box-shadow: 0px 0px 50px 10px #c9c9c9;
    -moz-box-shadow: 0px 0px 50px 10px #c9c9c9;
    box-shadow: 0px 0px 50px 10px #c9c9c9;
}

#content-inner {
    width:10000px;
    height: 480px;
}

.page {
    width: 640px;
    height: 480px;
    float: left;
}

.page-info {
    height: 90px;
    background-color: rgba(99, 99, 99, 0.6);
    position: relative;
    margin-top: 0px;
    bottom: 103px;
    color: #dedede;
    padding-left: 20px;
    padding-top: 10px;
}

.page-info h2 {
    font-size: 21px;
    margin-bottom: 10px;
    margin-top: 0px;
    color: #fafafa;
}

.page-text {
    font-size: 15px;
}

.button {
    float: left;
    background: #bababa;
    width: 16px;
    height: 16px;
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
    margin-top:10px;
    margin-left: 5px;
    margin-right: 5px;
}

.button:hover {
    -webkit-box-shadow: inset 0px 0px 2px 2px #d4d4d4;
    -moz-box-shadow: inset 0px 0px 2px 2px #d4d4d4;
    box-shadow: inset 0px 0px 2px 2px #d4d4d4;
}

.button:active {
    -webkit-box-shadow: inset 0px 0px 2px 2px #7a7a7a;
    -moz-box-shadow: inset 0px 0px 2px 2px #7a7a7a;
    box-shadow: inset 0px 0px 2px 2px #7a7a7a;
}

.button a {
    display: block;
    width: 16px;
    height: 16px;
}

#content-inner-1:target #content-inner {
    -webkit-transition: all 400ms ease;
    -moz-transition: all 400ms ease;
    -o-transition: all 400ms ease;
    transition: all 400ms ease;
    margin-left: 0px;
}

#content-inner-2:target #content-inner {
    -webkit-transition: all 400ms ease;
    -moz-transition: all 400ms ease;
    -o-transition: all 400ms ease;
    transition: all 400ms ease;
    margin-left: -640px;
}

#content-inner-3:target #content-inner {
    -webkit-transition: all 400ms ease;
    -moz-transition: all 400ms ease;
    -o-transition: all 400ms ease;
    transition: all 400ms ease;
    margin-left: -1280px;
}

#content-inner-4:target #content-inner {
    -webkit-transition: all 400ms ease;
    -moz-transition: all 400ms ease;
    -o-transition: all 400ms ease;
    transition: all 400ms ease;
    margin-left: -1920px;
}

#content-inner-5:target #content-inner {
    -webkit-transition: all 400ms ease;
    -moz-transition: all 400ms ease;
    -o-transition: all 400ms ease;
    transition: all 400ms ease;
    margin-left: -2560px;
}

#content-inner-6:target #content-inner {
    -webkit-transition: all 400ms ease;
    -moz-transition: all 400ms ease;
    -o-transition: all 400ms ease;
    transition: all 400ms ease;
    margin-left: -3200px;
}

但需要点击(请查看我的jsfiddle this)。我想像this网站一样自动从右向左滑动。有人可以帮帮我吗?

抱歉我的英语不好。感谢。

1 个答案:

答案 0 :(得分:0)

我建议你将Infinite Image slider with pure CSS3(用于多个图像之间的自动延迟/转换)与此How to create 'Slide-in gallery panels' with jQuery/CSS3?组合(对于滑动部分)。

告诉我您是否需要更多详细信息。