我正在尝试使此图像滑块更快。如果单击单选按钮以转到下一张幻灯片,似乎也存在问题,自动播放功能似乎会一起停止。

我可以看到有Web工具包关键帧,但我从未使用过它们,甚至不知道如何远程进行数学运算以使其完美运行。我从发现的免费资源中获取了此代码。因此,我确定有一些不需要的样式。但是任何建议都是如此。

有任何想法吗?



/* Making Thing Pretty
---------------------------- */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}
.opencanvascontainer {
	margin: 0 auto;
	max-width: 1140px;
}
[class*=bit-] {
	float: left;/*padding:.3em;*/
}
/* OBSW Grid System
---------------------------- */
.box {
	text-align: center;
	border: solid 1px black;
	color: #000;
	font-size: 12px;
	font-family: 'proxima_nova_rgregular', sans-serif;
	padding: 15px 10px 15px 10px;
}
.bit-1 {
	width: 100%;
}
.bit-2 {
	width: 50%;
}
.bit-3 {
	width: 33.33333%;
	padding: 20px;
}
.bit-4 {
	width: 25%;
}
.bit-5 {
	width: 20%;
}
.bit-6 {
	width: 16.66667%;
	padding: .3em;
}
.bit-7 {
	width: 14.28571%;
}
.bit-8 {
	width: 12.5%;
}
.bit-9 {
	width: 11.11111%;
}
.bit-10 {
	width: 10%;
}
.bit-11 {
	width: 9.09091%;
}
.bit-12 {
	width: 8.33333%;
}
.bit-25 {
	width: 25%;
}
.bit-40 {
	width: 40%;
}
.bit-60 {
	width: 60%;
}
.bit-75 {
	width: 75%;
}
.bit-35 {
	width: 35%;
}
.bit-65 {
	width: 65%;
}

/* Laptop */
@media (min-width:50em) and (max-width:68.75em) {
.bit-7, .bit-35, .bit-65 {
	width: 100%;
}
.bit-10, .bit-12, .bit-4, .bit-8 {
	width: 50%;
}
}

/* Tablet */
@media (min-width:30em) and (max-width:50em) {
.bit-10, .bit-12, .bit-4, .bit-6, .bit-8 {
	width: 50%;
}
.bit-1, .bit-11, .bit-3, .bit-5, .bit-7, .bit-9 {
	width: 100%;
}
}

/* Mobile */
@media (max-width:30em) {
.bit-1, .bit-10, .bit-11, .bit-12, .bit-2, .bit-3, .bit-4, .bit-5, .bit-6, .bit-7, .bit-8, .bit-9 {
	width: 100%;
}
}
/* -------------------------
End OBSW Grid System */



/* Full Width Wrapper
---------------------------- */
.fullwidthwrapper {
	width: 100%;
	padding-top: 150px;
}

@media (max-width:991px) {
.fullwidthwrapper {
	padding-top: 5px;
}
}

@media (max-width:907px) {
.fullwidthwrapper {
	padding-top: 5px;
	line-height: 42px;
}
}
/* -------------------------
End Full Width Wrapper */



/* Header Slider
---------------------------- */
.gallery .control-operator:target ~ .controls .control-button {
	color: #ccc;
	color: rgba(255, 255, 255, 0.4);
}
.gallery .control-button:first-of-type, .gallery .control-operator:nth-of-type(1):target ~ .controls .control-button:nth-of-type(1), .gallery .control-operator:nth-of-type(2):target ~ .controls .control-button:nth-of-type(2), .gallery .control-operator:nth-of-type(3):target ~ .controls .control-button:nth-of-type(3), .gallery .control-operator:nth-of-type(4):target ~ .controls .control-button:nth-of-type(4), .gallery .control-operator:nth-of-type(5):target ~ .controls .control-button:nth-of-type(5) {
	color: white;
	color: rgba(255, 255, 255, 0.8);
}
.gallery .item:first-of-type {
	position: static;
	pointer-events: auto;
	opacity: 1;
}
.gallery .item {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	opacity: 0;
	-webkit-transition: opacity .5s;
	-o-transition: opacity .5s;
	transition: opacity .5s;
}
.gallery .control-operator {
	display: none;
}
.gallery .control-operator:target ~ .item {
	pointer-events: none;
	opacity: 0;
	-webkit-animation: none;
	-o-animation: none;
	animation: none;
}
.gallery .control-operator:target ~ .controls .control-button {
	-webkit-animation: none;
	-o-animation: none;
	animation: none;
}
 @-webkit-keyframes controlAnimation-3 {
0% {
color: #ccc;
color: rgba(255, 255, 255, 0.4);
}
 9.5%, 33.3% {
 color: white;
 color: rgba(255, 255, 255, 0.8);
}
 42.9%, 100% {
 color: #ccc;
 color: rgba(255, 255, 255, 0.4);
}
}
 @-o-keyframes controlAnimation-3 {
 0% {
 color: #ccc;
 color: rgba(255, 255, 255, 0.4);
}
 9.5%, 33.3% {
 color: white;
 color: rgba(255, 255, 255, 0.8);
}
 42.9%, 100% {
 color: #ccc;
 color: rgba(255, 255, 255, 0.4);
}
}
 @keyframes controlAnimation-3 {
 0% {
 color: #ccc;
 color: rgba(255, 255, 255, 0.4);
}
 9.5%, 33.3% {
 color: white;
 color: rgba(255, 255, 255, 0.8);
}
 42.9%, 100% {
 color: #ccc;
 color: rgba(255, 255, 255, 0.4);
}
}
 @-webkit-keyframes galleryAnimation-3 {
 0% {
 opacity: 0;
}
 9.5%, 33.3% {
 opacity: 1;
}
 42.9%, 100% {
 opacity: 0;
}
}
 @-o-keyframes galleryAnimation-3 {
 0% {
 opacity: 0;
}
 9.5%, 33.3% {
 opacity: 1;
}
 42.9%, 100% {
 opacity: 0;
}
}
 @keyframes galleryAnimation-3 {
 0% {
 opacity: 0;
}
 9.5%, 33.3% {
 opacity: 1;
}
 42.9%, 100% {
 opacity: 0;
}
}
.gallery .control-operator:nth-of-type(1):target ~ .item:nth-of-type(1) {
	pointer-events: auto;
	opacity: 1;
}
.gallery .control-operator:nth-of-type(2):target ~ .item:nth-of-type(2) {
	pointer-events: auto;
	opacity: 1;
}
.gallery .control-operator:nth-of-type(3):target ~ .item:nth-of-type(3) {
	pointer-events: auto;
	opacity: 1;
}
.items-3.autoplay .control-button {
	-webkit-animation: controlAnimation-3 12s infinite;
	-o-animation: controlAnimation-3 12s infinite;
	animation: controlAnimation-3 12s infinite;
}
.items-3.autoplay .item {
	-webkit-animation: galleryAnimation-3 12s infinite;
	-o-animation: galleryAnimation-3 12s infinite;
	animation: galleryAnimation-3 12s infinite;
}
.items-3 .control-button:nth-of-type(1), .items-3 .item:nth-of-type(1) {
	-webkit-animation-delay: -2s;
	-o-animation-delay: -2s;
	animation-delay: -2s;
}
.items-3 .control-button:nth-of-type(2), .items-3 .item:nth-of-type(2) {
	-webkit-animation-delay: 2s;
	-o-animation-delay: 2s;
	animation-delay: 2s;
}
.items-3 .control-button:nth-of-type(3), .items-3 .item:nth-of-type(3) {
	-webkit-animation-delay: 6s;
	-o-animation-delay: 6s;
	animation-delay: 6s;
}
.gallery .control-button {
	color: #ccc;
	color: rgba(255, 255, 255, 0.4);
}
.gallery .control-button:hover {
	color: white;
	color: rgba(255, 255, 255, 0.8);
}
/*
	Theme controls how everything looks in Gallery CSS.
*/

.gallery {
	position: relative;
}
.gallery .item {
	height: auto;
	overflow: hidden;
	text-align: center;
	background: #e9e9e8; /* BACKGROUND COLOR HERE */
}
.gallery .controls {
	position: absolute;
	bottom: 0;
	width: 100%;
	text-align: center;
}
.gallery .control-button {
	display: inline-block;
	margin: 0 .02em;
	font-size: 3em;
	text-align: center;
	text-decoration: none;
	-webkit-transition: color .1s;
	-o-transition: color .1s;
	transition: color .1s;
}
.hpfullwidth-top {
	background-color: #fff;
	background-repeat: repeat;
	padding-top: 150px;
}

@media (max-width:991px) {
.hpfullwidth-top {
	padding-top: 5px;
}
}
.imageholder {
	max-width: 1140px;
	margin: 0 auto;
}
/* -------------------------
End Header Slider */



/* Image Hover
---------------------------- */
.fade {
	opacity: 1;
	transition: opacity .5s ease-in-out;
	-moz-transition: opacity .5s ease-in-out;
	-webkit-transition: opacity .5s ease-in-out;
}
fade:hover {
	opacity: 0.5;
}
/* -------------------------
End Image Hover */

<!-- Start Body Content -->

<div class="fullwidthwrapper">
  <div class="gallery autoplay items-3">
    <div class="control-operator" id="item-1">&nbsp;</div>
    <div class="control-operator" id="item-2">&nbsp;</div>
    <div class="control-operator" id="item-3">&nbsp;</div>
    <figure class="item"><a href="/all/bogofreeboots.cat?source=BOGOFREEMonetateFullWidthViewAll&amp;icid=20161116_holiday">
      <picture>
        <source media="(min-width: 50em)" srcset="//deichmann.scene7.com/is/image/deichmann/BOGOFREEHOMESLIDER?wid=2000&amp;fmt=gif" width="100%" />
        <source media="(min-width: 0em)" srcset="//deichmann.scene7.com/is/image/deichmann/SLIDER1-MOBILE?wid=580&amp;fmt=gif" width="100%" />
        <!-- img tag for browsers that do not support picture element --> <img alt="Get More. Save More." src="//deichmann.scene7.com/is/image/deichmann/BOGOFREEHOMESLIDER?wid=2000&amp;fmt=gif" width="100%" /> </picture>
      </a></figure>
    <figure class="item"><a href="/womens/bogofreeboots.cat?source=BOGOFREEMonetateFullWidthShopWomens&amp;icid=20161116_holiday">
      <picture>
        <source media="(min-width: 50em)" srcset="//deichmann.scene7.com/is/image/deichmann/SLIDER2?wid=1500&amp;fmt=jpg" width="100%" />
        <source media="(min-width: 0em)" srcset="//deichmann.scene7.com/is/image/deichmann/SLIDER2-MOBILE?wid=580&amp;fmt=jpg" width="100%" />
        <!-- img tag for browsers that do not support picture element --> <img alt="Get More. Save More." src="//deichmann.scene7.com/is/image/deichmann/SLIDER2?wid=1500&amp;fmt=jpg" width="100%" /> </picture>
      </a></figure>
    <figure class="item"><a href="/mens/bogofreeboots.cat?source=BOGOFREEMonetateFullWidthShopMens&amp;icid=20161116_holiday">
      <picture>
        <source media="(min-width: 50em)" srcset="//deichmann.scene7.com/is/image/deichmann/SLIDER3?wid=1500&amp;fmt=jpg" width="100%" />
        <source media="(min-width: 0em)" srcset="//deichmann.scene7.com/is/image/deichmann/SLIDER3-MOBILE?wid=580&amp;fmt=jpg" width="100%" />
        <!-- img tag for browsers that do not support picture element --> <img alt="Get More. Save More." src="//deichmann.scene7.com/is/image/deichmann/SLIDER3?wid=1500&amp;fmt=jpg" width="100%" /> </picture>
      </a></figure>
    <div class="controls"><a class="control-button" href="#item-1">&bull;</a> <a class="control-button" href="#item-2">&bull;</a> <a class="control-button" href="#item-3">&bull;</a></div>
  </div>
</div>

<!-- End Body Content -->





谢谢!

最佳答案

编辑:

这是示例:https://jsfiddle.net/oLajysar/2/

.items-3.autoplay .item {
    -webkit-animation: galleryAnimation-3 9s infinite;
    -o-animation: galleryAnimation-3 9s infinite;
    animation: galleryAnimation-3 9s infinite;
}


这是针对分开的滑动速度。这三个速度应与此相等。

.items-3 .control-button:nth-of-type(1), .items-3 .item:nth-of-type(1) {
    -webkit-animation-delay: 0s;
    -o-animation-delay: 0s;
    animation-delay: 0s;
}
.items-3 .control-button:nth-of-type(2), .items-3 .item:nth-of-type(2) {
    -webkit-animation-delay: 3s;
    -o-animation-delay: 3s;
    animation-delay: 3s;
}
.items-3 .control-button:nth-of-type(3), .items-3 .item:nth-of-type(3) {
    -webkit-animation-delay: 6s;
    -o-animation-delay: 6s;
    animation-delay: 6s;
}


这些是动画的延迟。因此,在我们画廊的9s时间范围内,
我们将在我们设置延迟时间的设置时间显示每个项目。

第一项将显示在0秒标记处,
第二项将显示在3秒标记处,并且
第三项将显示在6秒标记处。

我们的画廊有额外的3s,因为我们的最后(第三个)项目需要时间才能显示。

.items-3.autoplay .control-button {
    -webkit-animation: controlAnimation-3 9s infinite;
    -o-animation: controlAnimation-3 9s infinite;
    animation: controlAnimation-3 9s infinite;
}


这是项目选择器的延迟(底部的三个点)。
我们希望它与画廊同步,以便标记正确的项目。

关于html - 如何使该滑块更快?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41034095/

10-11 12:34