0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

slickで画像にリンクをつける方法

Posted at

こんにちは!
今日はjQueryで簡単に画像スライダーが実装できるプラグインslickについて、「npmインストールでつまづいた所」と「画像にリンクをつける方法」をお伝えしたいと思います!

npmでslickをインストールしたい

まずnpmでインストールするとき、つい公式ページを確認せずnpm i slickと打ちがちですが、これだとjQueryプラグインのslickは使えません!npm i slick-carouselでインストールしましょう!

画像にリンクをつける方法

画像リンクは<ul>の外に付けても意味ありませんでした。通常の画像リンクを実装するように<img>を囲うように付けましょう。

index.html
<ul class="slider">
  <li><a href="hogehoge"><img src="img.jpg" alt="" class="slider-img"></a></li>
  <li><a href="hogehoge"><img src="img.jpg" alt="" class="slider-img"></a></li>
</ul>

リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?