Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing Slick Carousel - New to JS [closed]

I'm totally new to Javascript as of today. I'm trying to get Slick Carousel working.

https://github.com/kenwheeler/slick/

Here's what I have so far:

<html>

<head>
  <link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/jquery.slick/1.5.5/slick.css" />
  <link rel="stylesheet" type="text/css" href="http://cdn.jsdelivr.net/jquery.slick/1.5.5/slick-theme.css" />
</head>

<body>

  <div class="your-class">
    <div>
      <img src="https://cdn.tutsplus.com/net/uploads/legacy/958_placeholders/placehold.gif">
    </div>
    <div>
      <img src="https://cdn.tutsplus.com/net/uploads/legacy/958_placeholders/placehold.gif">
    </div>
    <div>
      <img src="https://cdn.tutsplus.com/net/uploads/legacy/958_placeholders/placehold.gif">
    </div>
  </div>

  <script type="text/javascript">
    $(document).ready(function() {
      $('.your-class').slick();
    });
  </script>

  <script type="text/javascript" src="http://cdn.jsdelivr.net/jquery.slick/1.5.5/slick.min.js"></script>

</body>

</html>

Any ideas what I'm missing?

like image 645
GR-PLD Avatar asked Dec 15 '25 02:12

GR-PLD


1 Answers

You need to add jQuery dependency to your code as i said in comments because you are using dollar sign $. Just add a line of code from this:
https://developers.google.com/speed/libraries/.

Like this one
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

But BEFORE slick library.
(Yes, not before your script tag. Thanks josedefreitasc.)

like image 56
Toumash Avatar answered Dec 16 '25 19:12

Toumash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!