首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我怎样才能让这个滑块跑得更快?

我怎样才能让这个滑块跑得更快?
EN

Stack Overflow用户
提问于 2016-12-08 07:32:53
回答 1查看 73关注 0票数 1

我想让这个图像滑块跑得更快。如果单击单选按钮进入下一张幻灯片,自动播放功能似乎会停止。

我可以看到,有网络工具包的关键框架,但我从来没有使用它们,甚至知道如何远程计算,以使它完美地工作。我从我找到的免费源抓取了这段代码。所以我肯定有一些不需要的风格。但是,任何建议都是非常复杂的。

有什么想法吗?

代码语言:javascript
复制
/* 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 */
代码语言:javascript
复制
<!-- 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 -->

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-12-08 08:10:48

编辑:

下面是示例:https://jsfiddle.net/oLajysar/2/

代码语言:javascript
复制
.items-3.autoplay .item {
    -webkit-animation: galleryAnimation-3 9s infinite;
    -o-animation: galleryAnimation-3 9s infinite;
    animation: galleryAnimation-3 9s infinite;
}

这是用于分割的滑动速度。这三种速度应该是相等的。

代码语言:javascript
复制
.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;
}

这些都是动画的延迟。所以在我们展厅的9小时内,

我们将在我们设定的延迟时间显示每一项商品。

第一个项目将显示在0秒,

第二项将显示在3秒标记处,而

第三项将显示在6秒的标记。

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

代码语言:javascript
复制
.items-3.autoplay .control-button {
    -webkit-animation: controlAnimation-3 9s infinite;
    -o-animation: controlAnimation-3 9s infinite;
    animation: controlAnimation-3 9s infinite;
}

这是项目选择器的延迟(底部的三个点)。

我们希望这与我们的画廊同步,所以它将标记正确的项目。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41034095

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档