Skip to content

Commit 0fcd210

Browse files
committed
feat(mousewheel): add noMousewheelClass param
1 parent c9130c3 commit 0fcd210

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/modules/mousewheel/mousewheel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default function Mousewheel({ swiper, extendParams, on, emit }) {
1515
eventsTarget: 'container',
1616
thresholdDelta: null,
1717
thresholdTime: null,
18+
noMousewheelClass: 'swiper-no-mousewheel',
1819
},
1920
});
2021

@@ -178,7 +179,7 @@ export default function Mousewheel({ swiper, extendParams, on, emit }) {
178179
if (!swiper.enabled) return;
179180

180181
// Ignore event if the target or its parents have the swiper-no-mousewheel class
181-
if (event.target.closest(".swiper-no-mousewheel")) return;
182+
if (event.target.closest(`.${swiper.params.mousewheel.noMousewheelClass}`)) return;
182183

183184
const params = swiper.params.mousewheel;
184185

src/types/modules/mousewheel.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,11 @@ export interface MousewheelOptions {
7272
* @default null
7373
*/
7474
thresholdTime?: number | null;
75+
76+
/**
77+
* Scrolling on elements with this class will be ignored
78+
*
79+
* @default 'swiper-no-mousewheel'
80+
*/
81+
noMousewheelClass?: string;
7582
}

0 commit comments

Comments
 (0)