gpt4 book ai didi

jquery - 滑动时视差图像不会居中

转载 作者:太空宇宙 更新时间:2023-11-04 14:00:57 26 4
gpt4 key购买 nike

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />

<title>gallery</title>

<link rel="stylesheet" type="text/css" href="gallerystyle.css" />
<script type="text/javascript" src="js/modernizr.custom.28468.js"></script>
<link href='http://fonts.googleapis.com/css?family=Economica:700,400italic' rel='stylesheet' type='text/css'>
</head>

<body>
<header>
<div id="da-slider" class="da-slider">
<div class="da-slide">
<div class="da-img"><img src="gallery/comingsoon.jpg" alt="image01" /></div>
</div>
<div class="da-slide">
<div class="da-img"><img src="gallery/map.png" alt="image01" /></div>
</div>

<nav class="da-arrows">
<span class="da-arrows-prev"></span>
<span class="da-arrows-next"></span>
</nav>
</div>
</div>

这里有一点jscript

            <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cslider.js"></script>
<script type="text/javascript">
$(function() {

$('#da-slider').cslider();

});
</script>
</body>
</html>

这是 CSS 开始的地方

     body   {
padding-top:150px;
}

.da-slider{
width: 100%;
min-width: 520px;
height: 450px;
position: relative;
margin: 30px auto;
overflow: hidden;
background: transparent url(gallery/stardust.png) repeat 0% 0%;
border-top: 8px solid #efc34a;
border-bottom: 8px solid #efc34a;
box-shadow: 0px 1px 1px rgba(0,0,0,0.2), 0px -2px 1px #fff;
-webkit-transition: background-position 1.4s ease-in-out 0.3s;
-moz-transition: background-position 1.4s ease-in-out 0.3s;
-o-transition: background-position 1.4s ease-in-out 0.3s;
-ms-transition: background-position 1.4s ease-in-out 0.3s;
transition: background-position 1.4s ease-in-out 0.3s;
}
.da-slide{
position: absolute;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
text-align: left;
}

.da-slide p {
padding-top:10px;
}

.da-slide-current{
z-index: 1000;
}
.da-slider-fb .da-slide{
left: 100%;
}
.da-slider-fb .da-slide.da-slide-current{
left: 0px;
}
.da-slide h2,
.da-slide p,
.da-slide .da-link,
.da-slide .da-img{
position: absolute;
opacity: 0;
left: 110%;
}
.da-slider-fb .da-slide h2,
.da-slider-fb .da-slide p,
.da-slider-fb .da-slide .da-link{
left: 10%;
opacity: 1;
}
.da-slider-fb .da-slide .da-img{
left: 60%;
opacity: 1;
}
.da-slide h2{
color: #fff;
font-size: 66px;
width: 50%;
top: 60px;
white-space: nowrap;
z-index: 10;
text-shadow: 1px 1px 1px rgba(0,0,0,0.1);
font-family: 'Economica', Arial, sans-serif;
font-weight: 700;
}
.da-slide p{
width: 45%;
top: 155px;
color: #fff;
font-size: 18px;
line-height: 26px;
height: 80px;
overflow: hidden;
font-style: italic;
font-family: 'Economica', Arial, sans-serif;
font-weight: 400;
font-style: italic;
}
.da-slide .da-img{
text-align: center;
width: 30%;
top: 10px;
height: 256px;
line-height: 320px;
left: 110%; /*60%*/
}

.da-dots{
width: 100%;
position: absolute;
text-align: center;
left: 0px;
bottom: 20px;
z-index: 2000;
-moz-user-select: none;
-webkit-user-select: none;
}
.da-dots span{
display: inline-block;
position: relative;
width: 12px;
height: 12px;
border-radius: 50%;
background: #e4b42d;
margin: 3px;
cursor: pointer;
box-shadow:
1px 1px 1px rgba(0,0,0,0.1) inset,
1px 1px 1px rgba(255,255,255,0.1);
}
.da-dots span.da-dots-current:after{
content: '';
width: 8px;
height: 8px;
position: absolute;
top: 2px;
left: 2px;
border-radius: 50%;
background: rgb(255,255,255);
background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(246,246,246,1) 47%, rgba(237,237,237,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(47%,rgba(246,246,246,1)), color-stop(100%,rgba(237,237,237,1)));
background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%);
background: linear-gradient(top, rgba(255,255,255,1) 0%,rgba(246,246,246,1) 47%,rgba(237,237,237,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 );
}
.da-arrows{
-moz-user-select: none;
-webkit-user-select: none;
}
.da-arrows span{
position: absolute;
top: 50%;
height: 30px;
width: 30px;
border-radius: 50%;
background: #e4b42d;
cursor: pointer;
z-index: 2000;
opacity: 0;
box-shadow:
1px 1px 1px rgba(0,0,0,0.1) inset,
1px 1px 1px rgba(255,255,255,0.1);
-webkit-transition: opacity 0.4s ease-in-out 0.2s;
-moz-transition: opacity 0.4s ease-in-out 0.2s;
-o-transition: opacity 0.4s ease-in-out 0.2s;
-ms-transition: opacity 0.4s ease-in-out 0.2s;
transition: opacity 0.4s ease-in-out 0.2s;
}
.da-slider:hover .da-arrows span{
opacity: 1;
}
.da-arrows span:after{
content: '';
position: absolute;
width: 20px;
height: 20px;
top: 5px;
left: 5px;
background: transparent url(gallery/arrows.png) no-repeat top left;
border-radius: 50%;
box-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}
.da-arrows span:hover:after{
box-shadow: 1px 1px 4px rgba(0,0,0,0.3);
}
.da-arrows span:active:after{
box-shadow: 1px 1px 1px rgba(255,255,255,0.1);
}
.da-arrows span.da-arrows-next:after{
background-position: top right;
}
.da-arrows span.da-arrows-prev{
left: 15px;
}
.da-arrows span.da-arrows-next{
right: 15px;
}

这是我编辑的一小部分,因此图像在开始时居中而不是偏向右侧。

        .da-slide-current .da-img{
left: 25%;
opacity: 1;
}

从这里开始的所有动画都差不多

        /* Animation classes and animations */

从右侧滑入

        .da-slide-fromright .da-img{
-webkit-animation: fromRightAnim4 0.6s ease-in 0.8s both;
-moz-animation: fromRightAnim4 0.6s ease-in 0.8s both;
-o-animation: fromRightAnim4 0.6s ease-in 0.8s both;
-ms-animation: fromRightAnim4 0.6s ease-in 0.8s both;
animation: fromRightAnim4 0.6s ease-in 0.8s both;
}
@-webkit-keyframes fromRightAnim1{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-webkit-keyframes fromRightAnim2{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-webkit-keyframes fromRightAnim3{
0%{ left: 110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-webkit-keyframes fromRightAnim4{
0%{ left: 110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

@-moz-keyframes fromRightAnim1{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-moz-keyframes fromRightAnim2{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-moz-keyframes fromRightAnim3{
0%{ left: 110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-moz-keyframes fromRightAnim4{
0%{ left: 110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

@-o-keyframes fromRightAnim1{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-o-keyframes fromRightAnim2{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-o-keyframes fromRightAnim3{
0%{ left: 110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-o-keyframes fromRightAnim4{
0%{ left: 110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

@-ms-keyframes fromRightAnim1{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-ms-keyframes fromRightAnim2{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-ms-keyframes fromRightAnim3{
0%{ left: 110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-ms-keyframes fromRightAnim4{
0%{ left: 110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

@keyframes fromRightAnim1{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@keyframes fromRightAnim2{
0%{ left: 110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@keyframes fromRightAnim3{
0%{ left: 110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@keyframes fromRightAnim4{
0%{ left: 110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

从左边滑入

        .da-slide-fromleft .da-img{
-webkit-animation: fromLeftAnim4 0.6s ease-in 0.6s both;
-moz-animation: fromLeftAnim4 0.6s ease-in 0.6s both;
-o-animation: fromLeftAnim4 0.6s ease-in 0.6s both;
-ms-animation: fromLeftAnim4 0.6s ease-in 0.6s both;
animation: fromLeftAnim4 0.6s ease-in 0.6s both;
}
@-webkit-keyframes fromLeftAnim1{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-webkit-keyframes fromLeftAnim2{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-webkit-keyframes fromLeftAnim3{
0%{ left: -110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-webkit-keyframes fromLeftAnim4{
0%{ left: -110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

@-moz-keyframes fromLeftAnim1{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-moz-keyframes fromLeftAnim2{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-moz-keyframes fromLeftAnim3{
0%{ left: -110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-moz-keyframes fromLeftAnim4{
0%{ left: -110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

@-o-keyframes fromLeftAnim1{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-o-keyframes fromLeftAnim2{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-o-keyframes fromLeftAnim3{
0%{ left: -110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-o-keyframes fromLeftAnim4{
0%{ left: -110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

@-ms-keyframes fromLeftAnim1{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-ms-keyframes fromLeftAnim2{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-ms-keyframes fromLeftAnim3{
0%{ left: -110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@-ms-keyframes fromLeftAnim4{
0%{ left: -110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

@keyframes fromLeftAnim1{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@keyframes fromLeftAnim2{
0%{ left: -110%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@keyframes fromLeftAnim3{
0%{ left: -110%; opacity: 0; }
1%{ left: 10%; opacity: 0; }
100%{ left: 10%; opacity: 1; }
}
@keyframes fromLeftAnim4{
0%{ left: -110%; opacity: 0; }
100%{ left: 60%; opacity: 1; }
}

向右滑出

        .da-slide-toright .da-img{
-webkit-animation: toRightAnim4 0.6s ease-in both;
-moz-animation: toRightAnim4 0.6s ease-in both;
-o-animation: toRightAnim4 0.6s ease-in both;
-ms-animation: toRightAnim4 0.6s ease-in both;
animation: toRightAnim4 0.6s ease-in both;
}
@-webkit-keyframes toRightAnim1{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@-webkit-keyframes toRightAnim2{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@-webkit-keyframes toRightAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: 100%; opacity: 0; }
}
@-webkit-keyframes toRightAnim4{
0%{ left: 60%; opacity: 1; }
30%{ left: 55%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}

@-moz-keyframes toRightAnim1{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@-moz-keyframes toRightAnim2{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@-moz-keyframes toRightAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: 100%; opacity: 0; }
}
@-moz-keyframes toRightAnim4{
0%{ left: 60%; opacity: 1; }
30%{ left: 55%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}

@-o-keyframes toRightAnim1{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@-o-keyframes toRightAnim2{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@-o-keyframes toRightAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: 100%; opacity: 0; }
}
@-o-keyframes toRightAnim4{
0%{ left: 60%; opacity: 1; }
30%{ left: 55%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}

@-ms-keyframes toRightAnim1{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@-ms-keyframes toRightAnim2{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@-ms-keyframes toRightAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: 100%; opacity: 0; }
}
@-ms-keyframes toRightAnim4{
0%{ left: 60%; opacity: 1; }
30%{ left: 55%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}

@keyframes toRightAnim1{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@keyframes toRightAnim2{
0%{ left: 10%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}
@keyframes toRightAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: 100%; opacity: 0; }
}
@keyframes toRightAnim4{
0%{ left: 60%; opacity: 1; }
30%{ left: 55%; opacity: 1; }
100%{ left: 100%; opacity: 0; }
}

向左滑出

        .da-slide-toleft .da-img{
-webkit-animation: toLeftAnim4 0.6s ease-in 0.6s both;
-moz-animation: toLeftAnim4 0.6s ease-in 0.6s both;
-o-animation: toLeftAnim4 0.6s ease-in 0.6s both;
-ms-animation: toLeftAnim4 0.6s ease-in 0.6s both;
animation: toLeftAnim4 0.6s ease-in 0.6s both;
}
@-webkit-keyframes toLeftAnim1{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@-webkit-keyframes toLeftAnim2{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@-webkit-keyframes toLeftAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}
@-webkit-keyframes toLeftAnim4{
0%{ left: 60%; opacity: 1; }
40%{ left: 70%; opacity: 1; }
90%{ left: 0%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}

@-moz-keyframes toLeftAnim1{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@-moz-keyframes toLeftAnim2{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@-moz-keyframes toLeftAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}
@-moz-keyframes toLeftAnim4{
0%{ left: 60%; opacity: 1; }
40%{ left: 70%; opacity: 1; }
90%{ left: 0%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}

@-o-keyframes toLeftAnim1{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@-o-keyframes toLeftAnim2{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@-o-keyframes toLeftAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}
@-o-keyframes toLeftAnim4{
0%{ left: 60%; opacity: 1; }
40%{ left: 70%; opacity: 1; }
90%{ left: 0%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}

@-ms-keyframes toLeftAnim1{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@-ms-keyframes toLeftAnim2{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@-ms-keyframes toLeftAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}
@-ms-keyframes toLeftAnim4{
0%{ left: 60%; opacity: 1; }
40%{ left: 70%; opacity: 1; }
90%{ left: 0%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}

@keyframes toLeftAnim1{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@keyframes toLeftAnim2{
0%{ left: 10%; opacity: 1; }
30%{ left: 15%; opacity: 1; }
100%{ left: -50%; opacity: 0; }
}
@keyframes toLeftAnim3{
0%{ left: 10%; opacity: 1; }
99%{ left: 10%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}
@keyframes toLeftAnim4{
0%{ left: 60%; opacity: 1; }
40%{ left: 70%; opacity: 1; }
90%{ left: 0%; opacity: 0; }
100%{ left: -50%; opacity: 0; }
}

最佳答案

  • 你有一个 </div>而不是 </header>

  • 会不会是因为您只在当前一个上进行了居中,所以下面的可能不是您所想的当前一个?因为点击后焦点放在哪里:

    .da-slide .da-img{ 左:110%;

    .da-slide-current .da-img{ 左:25%;

关于jquery - 滑动时视差图像不会居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21520058/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com