<p align="center">
<a href="https://github.com/davidjerleke/embla-carousel" target="_blank"><img width="70" height="70" src="/assets/embla-logo.svg" alt="Embla Carousel"></a>
</p>
<h2 align="center">Wheel Gestures for Embla Carousel</h2>
<p align="center">
This plugin adds wheel interactions to the amazing
<a href="https://github.com/davidjerleke/embla-carousel">Embla Carousel</a>
</p>
<p align="center">
<a href="https://www.npmjs.com/package/embla-carousel-wheel-gestures" target="_blank">
<img src="https://img.shields.io/npm/v/embla-carousel-wheel-gestures.svg"
/></a>
<img alt="NPM" src="https://img.shields.io/npm/l/embla-carousel-wheel-gestures">
<a href="https://bundlephobia.com/result?p=embla-carousel-wheel-gestures@1.0.2" target="_blank">
<img
src="https://img.shields.io/bundlephobia/minzip/embla-carousel-wheel-gestures?color=%234c1&label=gzip%20size"
/>
</a>
</p>
## Installation
First you need to follow the [installation instructions for Embla Carousel](https://github.com/davidcetinkaya/embla-carousel#installation), after that you can add wheel support:
```sh
yarn add embla-carousel-wheel-gestures # npm install --save embla-carousel-wheel-gestures
```
### JavaScript / TypeScript
```js
import EmblaCarousel from 'embla-carousel'
import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures'
// initialize Embla Carousel
const embla = EmblaCarousel(emblaNode, options, [
WheelGesturesPlugin()
])
```
### React
```js
import { useEmblaCarousel } from 'embla-carousel-react'
import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures'
const EmblaCarouselComponent = ({ children }) => {
const [emblaRef, embla] = useEmblaCarousel({ loop: false, skipSnaps: true }, [
WheelGesturesPlugin(),
])
// ...
}
```
## Examples
<p>Get started instantly with one of the CodeSandboxes below.</p>
<p>
<img src="/assets/codesandbox.svg" height="23" align="top" />
<a href="https://codesandbox.io/s/github/xiel/embla-carousel-wheel-gestures/tree/master/docs/vanilla?file=/src/js/index.ts:1240-1266" target="_blank">
<code>JavaScript / TypeScript</code>
</a>
</p>
<p>
<img src="/assets/codesandbox.svg" height="23" align="top" />
<a href="https://codesandbox.io/s/github/xiel/embla-carousel-wheel-gestures/tree/master/docs/react?file=/src/js/EmblaCarousel.tsx:879-942" target="_blank">
<code>React (embla-carousel-react)</code>
</a>
</p>
## Options
### wheelDraggingClass
**Type**: string<br/>
**Default**: is-wheel-dragging
Choose a classname that will be applied to the container during a wheel gesture. Pass an empty string to opt-out.
### forceWheelAxis
**Type**: 'x' | 'y'<br/>
**Default**: undefined
Force an axis on which to listen for wheel events. Useful if you want to slide horizontally when scrolling vertically or vice versa.
### target
**Type**: Element<br/>
**Default**: undefined
Specify the element that should be observed for wheel events.
## Global Options
You can also set global options that will be applied to all instances. This allows for overriding the default plugin options with your own:
```js
WheelGesturesPlugin.globalOptions = {
wheelDraggingClass: 'my-class',
}
```
## OS & Browser Support
- Mac OS (Chrome, Firefox, Safari, Edge), Magic Mouse, Magic Trackpad
- Windows (Chrome, Firefox, Edge), Microsoft Precision Touchpads
#### Legacy Browsers
If you need to support IE 10 & 11 you might need to install and add extra polyfills:
```js
// Adds support old IE >= 10
import 'core-js/stable'
import 'events-polyfill/src/constructors/MouseEvent'
```
## Thanks
Kudos to [David Jerleke](https://github.com/davidjerleke) for creating [Embla Carousel](https://github.com/davidjerleke/embla-carousel) with its open API ����
## License
MIT.
没有合适的资源?快使用搜索试试~ 我知道了~
EmblaCarousel的滚轮交互_TypeScript_JavaScript_下载.zip
共52个文件
ts:12个
json:10个
css:7个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 103 浏览量
2023-05-01
11:40:23
上传
评论
收藏 172KB ZIP 举报
温馨提示
EmblaCarousel的滚轮交互_TypeScript_JavaScript_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
EmblaCarousel的滚轮交互_TypeScript_JavaScript_下载.zip (52个子文件)
embla-carousel-wheel-gestures-master
yarn.lock 354KB
.eslintrc.js 654B
.prettierrc 117B
.github
workflows
dependabot.yml 223B
.kodiak.toml 81B
nodejs.yml 760B
embla-carousel-wheel-gestures
src
WheelGesturesPlugin.ts 6KB
index.ts 88B
umd.ts 71B
package.json 2KB
tsdx.config.js 662B
test
options.test.ts 2KB
export.test.ts 209B
tsconfig.json 118B
assets
codesandbox.svg 245B
embla-logo.svg 13KB
LICENSE 1KB
.nvmrc 4B
docs
vanilla
sandbox.config.json 127B
src
js
dotButtons.ts 804B
directionRTL.ts 294B
radioButtons.ts 308B
prevAndNextButtons.ts 537B
styles.ts 103B
index.ts 2KB
shadow
index.ts 1010B
css
radio.css 118B
reset.css 2KB
embla.css 2KB
base.css 467B
package.json 677B
umd.html 2KB
index.html 3KB
.gitignore 55B
tsconfig.json 243B
shadow.html 3KB
react
sandbox.config.json 128B
src
js
index.tsx 691B
EmblaCarouselButtons.tsx 1KB
EmblaCarousel.tsx 3KB
css
reset.css 2KB
embla.css 2KB
base.css 716B
package.json 585B
index.html 439B
.gitignore 55B
tsconfig.json 283B
package.json 740B
.gitignore 175B
.eslintignore 167B
tsconfig.json 443B
README.md 4KB
共 52 条
- 1
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 目标跟踪-基于目标中心点同时进行目标检测+目标跟踪算法实现-项目源码-优质项目实战.zip
- Python《文本特征分析-全唐诗数据挖掘及分析 》+源代码
- Netron-Setup-4.5.0
- 可编辑的地图图形3-世界、各洲、美国地图.xls
- NineAi 新版ChatGPT AI系统网站源码
- Anaconda3-2022.10windows版本
- 基于Servlet的URL访问安全控制.doc
- 可编辑的地图图形-2-中国到省、到市、到县地图.xls
- 快慢指针法判断链表是否有环-go语言实现
- Python《金融新闻数据挖掘分析 (数据抓取、NLP算法分析、量化策略、回测框架等)》+源代码+项目说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功