Skip to content

Commit

Permalink
feat(mousewheel): add noMousewheelClass param
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed May 15, 2023
1 parent c9130c3 commit 0fcd210
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/mousewheel/mousewheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default function Mousewheel({ swiper, extendParams, on, emit }) {
eventsTarget: 'container',
thresholdDelta: null,
thresholdTime: null,
noMousewheelClass: 'swiper-no-mousewheel',
},
});

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

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

const params = swiper.params.mousewheel;

Expand Down
7 changes: 7 additions & 0 deletions src/types/modules/mousewheel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,11 @@ export interface MousewheelOptions {
* @default null
*/
thresholdTime?: number | null;

/**
* Scrolling on elements with this class will be ignored
*
* @default 'swiper-no-mousewheel'
*/
noMousewheelClass?: string;
}

0 comments on commit 0fcd210

Please sign in to comment.