2017-06-01 4 views
0

Ich versuche, einen Slider zu meiner Website hinzuzufügen. Ich habe es von dieser Seite: https://bootsnipp.com/snippets/K3Al3.Slider funktioniert nicht

Ich füge HTML-Codes, CSS-Codes und Javascript-Codes hinzu, aber Slider funktioniert nicht.

Wer hat eine Idee?

Dies sind die Codes:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> 

<div id="first-slider"> 
<div id="carousel-example-generic" class="carousel slide carousel-fade"> 
    <!-- Indicators --> 
    <ol class="carousel-indicators"> 
     <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li> 
     <li data-target="#carousel-example-generic" data-slide-to="1"></li> 
     <li data-target="#carousel-example-generic" data-slide-to="2"></li> 
     <li data-target="#carousel-example-generic" data-slide-to="3"></li> 
    </ol> 
    <!-- Wrapper for slides --> 
    <div class="carousel-inner" role="listbox"> 
     <!-- Item 1 --> 
     <div class="item active slide1"> 
      <div class="row"><div class="container"> 
       <div class="col-md-3 text-right"> 
        <img style="max-width: 200px;" data-animation="animated zoomInLeft" src="http://s20.postimg.org/pfmmo6qj1/window_domain.png"> 
       </div> 
       <div class="col-md-9 text-left"> 
        <h3 data-animation="animated bounceInDown">Add images, or even your logo!</h3> 
        <h4 data-animation="animated bounceInUp">Easily use stunning effects</h4>    
       </div> 
      </div></div> 
     </div> 
     <!-- Item 2 --> 
     <div class="item slide2"> 
      <div class="row"><div class="container"> 
       <div class="col-md-7 text-left"> 
        <h3 data-animation="animated bounceInDown"> 50 animation options A beautiful</h3> 
        <h4 data-animation="animated bounceInUp">Create beautiful slideshows </h4> 
       </div> 
       <div class="col-md-5 text-right"> 
        <img style="max-width: 200px;" data-animation="animated zoomInLeft" src="http://s20.postimg.org/sp11uneml/rack_server_unlock.png"> 
       </div> 
      </div></div> 
     </div> 
     <!-- Item 3 --> 
     <div class="item slide3"> 
      <div class="row"><div class="container"> 
       <div class="col-md-7 text-left"> 
        <h3 data-animation="animated bounceInDown">Simple Bootstrap Carousel</h3> 
        <h4 data-animation="animated bounceInUp">Bootstrap Image Carousel Slider with Animate.css</h4> 
       </div> 
       <div class="col-md-5 text-right"> 
        <img style="max-width: 200px;" data-animation="animated zoomInLeft" src="http://s20.postimg.org/eq8xvxeq5/globe_network.png"> 
       </div>  
      </div></div> 
     </div> 
     <!-- Item 4 --> 
     <div class="item slide4"> 
      <div class="row"><div class="container"> 
       <div class="col-md-7 text-left"> 
        <h3 data-animation="animated bounceInDown">We are creative</h3> 
        <h4 data-animation="animated bounceInUp">Get start your next awesome project</h4> 
       </div> 
       <div class="col-md-5 text-right"> 
        <img style="max-width: 200px;" data-animation="animated zoomInLeft" src="http://s20.postimg.org/9vf8xngel/internet_speed.png"> 
       </div> 
      </div></div> 
     </div> 
     <!-- End Item 4 --> 

    </div> 
    <!-- End Wrapper for slides--> 
    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> 
     <i class="fa fa-angle-left"></i><span class="sr-only">Previous</span> 
    </a> 
    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> 
     <i class="fa fa-angle-right"></i><span class="sr-only">Next</span> 
    </a> 
</div> 

(function($) { 

//Function to animate slider captions 
function doAnimations(elems) { 
    //Cache the animationend event in a variable 
    var animEndEv = 'webkitAnimationEnd animationend'; 

    elems.each(function() { 
     var $this = $(this), 
      $animationType = $this.data('animation'); 
     $this.addClass($animationType).one(animEndEv, function() { 
      $this.removeClass($animationType); 
     }); 
    }); 
} 

//Variables on page load 
var $myCarousel = $('#next'), 
    $firstAnimatingElems = $myCarousel.find('.item:first').find("[data-animation ^= 'animated']"); 

//Initialize carousel 
$myCarousel.carousel(); 

//Animate captions in first slide on page load 
doAnimations($firstAnimatingElems); 

//Pause carousel 
$myCarousel.carousel('pause'); 


//Other slides to be animated on carousel slide event 
$myCarousel.on('slide.bs.carousel', function (e) { 
    var $animatingElems = $(e.relatedTarget).find("[data-animation ^= 'animated']"); 
    doAnimations($animatingElems); 
}); 
$('#carousel-example-generic').carousel({ 
    interval:3000, 
    pause: "false" 
}); 

})(jQuery); 
+0

Welche Fehler Sie in Ihren Browser-Konsole bekomme? – j08691

+1

Ich nehme an, Sie haben wahrscheinlich vergessen, die JQuery-Bibliothek zu integrieren, da das Plugin JQuery verwendet, nach was erhalten Sie in der Konsole? – Jorden1337

+0

Es gibt keinen Fehler im Browser. Ich habe die JQery-Bibliothek hinzugefügt. Ich füge eine Warnung zu JavaScript-Codes, die es funktioniert, aber Schieberegler funktioniert nicht – Emre

Antwort

1

Ich denke, dass jQuery in Ihrem Code fehlt. Sie können eine beliebige jQuery-Bibliothek vor dem Skript einfügen. Verwenden Sie die CDN-Bibliothek und die Bootstrap-Bibliothek.

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css"> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> 
<link rel="stylesheet" href="http://cdn.bootcss.com/animate.css/3.5.1/animate.min.css"> 
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script> 
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> 
+0

Ich füge es hinzu, aber es hat nicht funktioniert. – Emre

+0

Auch Bootstrap-Bibliothek hinzufügen – AdhershMNair

+0

Vielen Dank. Es hat funktioniert ... Du bist sehr schlau und gute Person, ich habe versucht, es für 2-3 Stunden richtig zu machen ... Danke – Emre

0

Verwenden Sie diese Header

<!-- headers for https://bootsnipp.com --><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"><link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"><link rel="stylesheet" href="http://cdn.bootcss.com/animate.css/3.5.1/animate.min.css"><script src="https:////code.jquery.com/jquery-1.11.0.min.js"></script><script src="https:////netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"</script><script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>