gpt4 book ai didi

jquery - CSS3 slider 重新排列图像位置

转载 作者:行者123 更新时间:2023-11-28 10:45:15 25 4
gpt4 key购买 nike

我正在研究视差 CSS3 slider http://tympanus.net/codrops/2012/03/15/parallax-content-slider-with-css3-and-jquery/

我正在尝试重新排列图像位置,但遇到的问题是我无法从左侧或右侧找到图像的位置。您知道如何轻松地从左侧或右侧移动图像吗?

这是 CSS3 代码:

.da-slider{
width: 100%;
min-width: 520px;
height: 768px; /*400px;*/
position: relative;
overflow: hidden;
background: transparent url(../images/waves.gif) 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-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: #916c05;
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: 200px;
height: 256px;
line-height: 320px; /*60%*/
position: absolute;
right: 0px;
}
.da-slide-current h2,
.da-slide-current p,
.da-slide-current .da-link{
left: 10%;
opacity: 1;
}
.da-slide-current .da-img{
left: 60%;
opacity: 1;
}

HTML 是:

<div id="da-slider" class="da-slider">
<div class="da-slide">
<h2>Easy management</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.</p>
<a href="#" class="da-link">Read more</a>
<div class="da-img"><img src="images/2.png" alt="image01" /></div>
</div>
<div class="da-slide">
<h2>Revolution</h2>
<p>A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.</p>
<a href="#" class="da-link">Read more</a>
<div class="da-img"><img src="images/3.png" alt="image01" /></div>
</div>
<div class="da-slide">
<h2>Warm welcome</h2>
<p>When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane.</p>
<a href="#" class="da-link">Read more</a>
<div class="da-img"><img src="images/1.png" alt="image01" /></div>
</div>
<div class="da-slide">
<h2>Quality Control</h2>
<p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p>
<a href="#" class="da-link">Read more</a>
<div class="da-img"><img src="images/4.png" alt="image01" /></div>
</div>
<nav class="da-arrows">
<span class="da-arrows-prev"></span>
<span class="da-arrows-next"></span>
</nav>
</div>

最佳答案

如果“尝试重新排列图像位置”是指为其设置动画或更改其动画方式,则应查看这些 css 类:

.da-slide-fromright
.da-slide-fromleft
.da-slide-toright
.da-slide-toleft

从问题中发布的链接可以看出,这些类包含 animation CSS3 样式。这用于调用 @keyframes CSS3 动画,这在大多数情况下都是最快的。

因此要更改动画,请更新 @keyframes 动画中的左侧位置。

例如:

@keyframes fromRightAnim1{
0%{ left: 110%; opacity: 0;}
100%{ left: 10%; opacity: 1;}
}

@keyframes fromRightAnim1{
0%{ left: 110%; opacity: 0; top: 0%;}
100%{ left: 10%; opacity: 1; top: 15%; }
}

编辑:

尝试在 style.css 的末尾添加这个类

.da-slide-current .da-img{
top:20px;
left:10px;
}

编辑 2:

jQuery 方式

$('.da-img').css({ top: '10px', left: '10px' });

关于jquery - CSS3 slider 重新排列图像位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23015495/

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