【问题标题】:Hello, can I want to know how to install and use swiperjs你好,请问swiperjs如何安装和使用?
【发布时间】:2021-12-18 20:23:21
【问题描述】:

我是 swiper js 的新手,我想知道如何使用它。很困惑,我安装swiper js和导入的时候有什么区别

【问题讨论】:

  • 请务必阅读如何询问good question。并在提问之前尝试使用google 进行搜索。

标签: swiper.js


【解决方案1】:

当您通过npm 安装它时,您将使用 Webpack、Bable 或 Browserify 之类的东西将其构建到您的网站中。虽然这对于大型项目很有用,但如果您是 Web 开发的新手,我不建议您使用它。

更简单的使用方法是通过 CDN(内容分发网络)。这只是一个为您托管所有代码的网站,您可以自己导入这些代码。对于 Swiper.js,您可以将其添加到您的 HTML 代码中:

<!-- Add to your <head> -->
<link rel="stylesheet" href="https://unpkg.com/swiper@7/swiper-bundle.min.css" />

<!-- Add to the bottom of the <body> -->
<script src="https://unpkg.com/swiper@7/swiper-bundle.min.js"></script>

然后,您可以像往常一样在代码中使用 Swiper.js :)

【讨论】:

    猜你喜欢
    • 2020-03-21
    • 2010-12-30
    • 2018-03-24
    • 2016-07-22
    • 2010-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多