2016-12-16 4 views
0

Wie mache ich diesen Slider automatisch abspielen? Ich habe fast alles ausprobiert, und ich bin nicht so gut bei Javascript. Wenn jemand irgendwelche Ideen hat, kann ich dieses Ding automatisch spielen lassen und in der Lage sein, die Geschwindigkeit einzustellen, die erstaunlich wäre!Lassen Sie diesen Regler automatisch abspielen

Hier ist meine aktuelle Markup.

var item_length = $('.swiper-slide > div').length - 1; 
 
var slider = $('.swiper-slide').slick({ 
 
    autoplay: true, 
 
    autoplaySpeed: 1000, 
 
    dots: true, 
 
    infinite: true, 
 
    speed: 1000, 
 
    fade: true, 
 
    slide: 'div', 
 
    cssEase: 'linear' 
 
});
.swiper-container { 
 
     width: 100%; 
 
     height: auto; 
 
    } 
 
    .swiper-slide { 
 
     text-align: center; 
 
     font-size: 18px; 
 
     background: #fff; 
 

 
     /* Center slide text vertically */ 
 
     display: -webkit-box; 
 
     display: -ms-flexbox; 
 
     display: -webkit-flex; 
 
     display: flex; 
 
     -webkit-box-pack: center; 
 
     -ms-flex-pack: center; 
 
     -webkit-justify-content: center; 
 
     justify-content: center; 
 
     -webkit-box-align: center; 
 
     -ms-flex-align: center; 
 
     -webkit-align-items: center; 
 
     align-items: center; 
 
    } 
 
\t 
 
\t .swiper-container { 
 
    margin: 0 auto; 
 
    position: relative; 
 
    overflow: hidden; 
 
    /* Fix of Webkit flickering */ 
 
    z-index: 1; 
 
} 
 
.swiper-container-no-flexbox .swiper-slide { 
 
    float: left; 
 
} 
 
.swiper-container-vertical > .swiper-wrapper { 
 
    -webkit-box-orient: vertical; 
 
    -moz-box-orient: vertical; 
 
    -ms-flex-direction: column; 
 
    -webkit-flex-direction: column; 
 
    flex-direction: column; 
 
} 
 
.swiper-wrapper { 
 
    position: relative; 
 
    width: 100%; 
 
    z-index: 1; 
 
    display: -webkit-box; 
 
    display: -moz-box; 
 
    display: -ms-flexbox; 
 
    display: -webkit-flex; 
 
    display: flex; 
 
    -webkit-transition-property: -webkit-transform; 
 
    -moz-transition-property: -moz-transform; 
 
    -o-transition-property: -o-transform; 
 
    -ms-transition-property: -ms-transform; 
 
    transition-property: transform; 
 
    -webkit-box-sizing: content-box; 
 
    -moz-box-sizing: content-box; 
 
    box-sizing: content-box; 
 
} 
 
.swiper-container-android .swiper-slide, 
 
.swiper-wrapper { 
 
    -webkit-transform: translate3d(0px, 0, 0); 
 
    -moz-transform: translate3d(0px, 0, 0); 
 
    -o-transform: translate(0px, 0px); 
 
    -ms-transform: translate3d(0px, 0, 0); 
 
    transform: translate3d(0px, 0, 0); 
 
} 
 
.swiper-container-multirow > .swiper-wrapper { 
 
    -webkit-box-lines: multiple; 
 
    -moz-box-lines: multiple; 
 
    -ms-flex-wrap: wrap; 
 
    -webkit-flex-wrap: wrap; 
 
    flex-wrap: wrap; 
 
} 
 
.swiper-container-free-mode > .swiper-wrapper { 
 
    -webkit-transition-timing-function: ease-out; 
 
    -moz-transition-timing-function: ease-out; 
 
    -ms-transition-timing-function: ease-out; 
 
    -o-transition-timing-function: ease-out; 
 
    transition-timing-function: ease-out; 
 
    margin: 0 auto; 
 
} 
 
.swiper-slide { 
 
    -webkit-flex-shrink: 0; 
 
    -ms-flex: 0 0 auto; 
 
    flex-shrink: 0; 
 
    width: 100%; 
 
    position: relative; 
 
} 
 
/* Auto Height */ 
 
.swiper-container-autoheight, 
 
.swiper-container-autoheight .swiper-slide { 
 
    height: auto; 
 
} 
 
.swiper-container-autoheight .swiper-wrapper { 
 
    -webkit-box-align: start; 
 
    -ms-flex-align: start; 
 
    -webkit-align-items: flex-start; 
 
    align-items: flex-start; 
 
    -webkit-transition-property: -webkit-transform, height; 
 
    -moz-transition-property: -moz-transform; 
 
    -o-transition-property: -o-transform; 
 
    -ms-transition-property: -ms-transform; 
 
    transition-property: transform, height; 
 
} 
 

 
/* Pagination Styles */ 
 
.swiper-pagination { 
 
    position: absolute; 
 
    text-align: center; 
 
    -webkit-transition: 300ms; 
 
    -moz-transition: 300ms; 
 
    -o-transition: 300ms; 
 
    transition: 300ms; 
 
    -webkit-transform: translate3d(0, 0, 0); 
 
    -ms-transform: translate3d(0, 0, 0); 
 
    -o-transform: translate3d(0, 0, 0); 
 
    transform: translate3d(0, 0, 0); 
 
    z-index: 10; 
 
} 
 
.swiper-pagination.swiper-pagination-hidden { 
 
    opacity: 0; 
 
} 
 
/* Common Styles */ 
 
.swiper-pagination-fraction, 
 
.swiper-pagination-custom, 
 
.swiper-container-horizontal > .swiper-pagination-bullets { 
 
    bottom: 10px; 
 
    left: 0; 
 
    width: 100%; 
 
} 
 
/* Bullets */ 
 
.swiper-pagination-bullet { 
 
    width: 8px; 
 
    height: 8px; 
 
    display: inline-block; 
 
    border-radius: 100%; 
 
    background: #000; 
 
    opacity: 0.2; 
 
} 
 
button.swiper-pagination-bullet { 
 
    border: none; 
 
    margin: 0; 
 
    padding: 0; 
 
    box-shadow: none; 
 
    -moz-appearance: none; 
 
    -ms-appearance: none; 
 
    -webkit-appearance: none; 
 
    appearance: none; 
 
} 
 
.swiper-pagination-clickable .swiper-pagination-bullet { 
 
    cursor: pointer; 
 
} 
 
.swiper-pagination-white .swiper-pagination-bullet { 
 
    background: #fff; 
 
} 
 
.swiper-pagination-bullet-active { 
 
    opacity: 1; 
 
    background: #ed1b2e; 
 
} 
 
.swiper-pagination-white .swiper-pagination-bullet-active { 
 
    background: #fff; 
 
} 
 
.swiper-pagination-black .swiper-pagination-bullet-active { 
 
    background: #000; 
 
} 
 

 
.swiper-container-horizontal > .swiper-pagination-bullets .swiper-pagination-bullet { 
 
    margin: 0 5px; 
 
} 
 

 
/* Preloader */ 
 
.swiper-lazy-preloader { 
 
    width: 42px; 
 
    height: 42px; 
 
    position: absolute; 
 
    left: 50%; 
 
    top: 50%; 
 
    margin-left: -21px; 
 
    margin-top: -21px; 
 
    z-index: 10; 
 
    -webkit-transform-origin: 50%; 
 
    -moz-transform-origin: 50%; 
 
    transform-origin: 50%; 
 
    -webkit-animation: swiper-preloader-spin 1s steps(12, end) infinite; 
 
    -moz-animation: swiper-preloader-spin 1s steps(12, end) infinite; 
 
    animation: swiper-preloader-spin 1s steps(12, end) infinite; 
 
} 
 
.swiper-lazy-preloader:after { 
 
    display: block; 
 
    content: ""; 
 
    width: 100%; 
 
    height: 100%; 
 
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%236c6c6c'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); 
 
    background-position: 50%; 
 
    -webkit-background-size: 100%; 
 
    background-size: 100%; 
 
    background-repeat: no-repeat; 
 
} 
 
.swiper-lazy-preloader-white:after { 
 
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%23fff'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E"); 
 
} 
 
@-webkit-keyframes swiper-preloader-spin { 
 
    100% { 
 
    -webkit-transform: rotate(360deg); 
 
    } 
 
} 
 
@keyframes swiper-preloader-spin { 
 
    100% { 
 
    transform: rotate(360deg); 
 
    } 
 
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.js"></script> 
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> 
 
<!-- HERO SLIDER --> 
 
<div class="swiper-container" style="margin-top:-40px;"> 
 
<div class="swiper-wrapper"><!-- SLIDE 1 --> 
 
<div class="swiper-slide"><a href="/search.html?q="><img alt="" src="http://deichmann.scene7.com/is/content/deichmann/obs/Media/Mobile%2DApp%2DMedia/20161206%2DBOGO50.gif" width="100%" /></a></div> 
 
<!-- END --><!-- SLIDE 2 --> 
 

 
<div class="swiper-slide"><a href="/search.html?q=%3Arelevance%3Abrand%3ANike"><img alt="" src="http://deichmann.scene7.com/is/image/deichmann/20161206-NIKESALEWEEK?wid=580&amp;fmt=gif" width="100%" /></a></div> 
 
<!-- END --></div> 
 

 
<div class="swiper-pagination">&nbsp;</div> 
 
</div> 
 
<!-- END HERO SLIDER -->

Vielen Dank für die Hilfe!

Antwort

0

Sie müssen jquery vor das Plugin einschließen. <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.js"></script>

Verwandte Themen