Skip to content

Commit

Permalink
fix(navigation): fix lock class on enable
Browse files Browse the repository at this point in the history
fixes #7009
  • Loading branch information
nolimits4web committed Sep 6, 2023
1 parent b96fed6 commit ea39c33
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/modules/navigation/navigation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default function Navigation({ swiper, extendParams, on, emit }) {
prevEl: null,
};

const makeElementsArray = el =>
(Array.isArray(el) ? el : [el]).filter((e) => !!e)
const makeElementsArray = (el) => (Array.isArray(el) ? el : [el]).filter((e) => !!e);

function getEl(el) {
let res;
Expand Down Expand Up @@ -148,11 +147,13 @@ export default function Navigation({ swiper, extendParams, on, emit }) {
let { nextEl, prevEl } = swiper.navigation;
nextEl = makeElementsArray(nextEl);
prevEl = makeElementsArray(prevEl);
if (swiper.enabled) {
update();
return;
}
[...nextEl, ...prevEl]
.filter((el) => !!el)
.forEach((el) =>
el.classList[swiper.enabled ? 'remove' : 'add'](swiper.params.navigation.lockClass),
);
.forEach((el) => el.classList.add(swiper.params.navigation.lockClass));
});
on('click', (_s, e) => {
let { nextEl, prevEl } = swiper.navigation;
Expand Down

0 comments on commit ea39c33

Please sign in to comment.