LoginSignup
1
1

More than 3 years have passed since last update.

swiper.min.cssが404のとき

Posted at

スライダー が突如表示崩れした

→だいたいcdnのせい。
console見るとswiper.min.cssが404になってる。

unpkgはdist用で使うな

swiperの公式に、

a. Use Swiper from CDN
If you don't want to include Swiper files in your project, you may use it from CDN. The following files are available:


<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.css">
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">

<script src="https://unpkg.com/swiper/swiper-bundle.js"></script>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>

これを鵜呑みにしてはいけない。
そもそもunpkgはお試しみたいなもん。
以下のサイトはそう言ってる(公式だとどこに書いてあるかわからなかった)。

unpkg is great for open source project demos and instructional material (I use it heavily in my Beginner's Guide to ReactJS), but it’s not well suited for mission-critical applications at scale because:
unpkg is a free, best-effort service and cannot provide any uptime or support guarantees.
That’s why Michael recommends:
if you rely on it to serve files that are crucial to your business, you should probably pay for a host with well-supported infrastructure and uptime guarantees.

本番環境での利用は推薦されていませんが、プロジェクトで使うか検討したい時、
codepen等のオンラインエディタで使用する時には 非常に役立つサービスです。

じゃあどうする

cloudflare使おうぜ
https://cdnjs.com/libraries/Swiper







swiper便利だけど、IE11非対応(というか内部のdom7)なので、うまいこと対処して使おう

1
1
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
1
1