Skip to content

Commit

Permalink
fix(navigation): allow multiple classes for disabledClass, `navigat…
Browse files Browse the repository at this point in the history
…ionDisabledClass` and `lockClass`

fixes nolimits4web#6344
  • Loading branch information
benedictdudel committed Feb 3, 2023
1 parent 9fe9a96 commit 772ce3e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/modules/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function Navigation({ swiper, extendParams, on, emit }) {
el = makeElementsArray(el);
el.forEach((subEl) => {
if (subEl) {
subEl.classList[disabled ? 'add' : 'remove'](params.disabledClass);
subEl.classList[disabled ? 'add' : 'remove'](params.disabledClass.split(' '));
if (subEl.tagName === 'BUTTON') subEl.disabled = disabled;
if (swiper.params.watchOverflow && swiper.enabled) {
subEl.classList[swiper.isLocked ? 'add' : 'remove'](params.lockClass);
Expand Down Expand Up @@ -112,7 +112,7 @@ export default function Navigation({ swiper, extendParams, on, emit }) {
el.addEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
}
if (!swiper.enabled && el) {
el.classList.add(params.lockClass);
el.classList.add(params.lockClass.split(' '));
}
};

Expand All @@ -125,7 +125,7 @@ export default function Navigation({ swiper, extendParams, on, emit }) {
prevEl = makeElementsArray(prevEl);
const destroyButton = (el, dir) => {
el.removeEventListener('click', dir === 'next' ? onNextClick : onPrevClick);
el.classList.remove(swiper.params.navigation.disabledClass);
el.classList.remove(swiper.params.navigation.disabledClass.split(' '));
};
nextEl.forEach((el) => destroyButton(el, 'next'));
prevEl.forEach((el) => destroyButton(el, 'prev'));
Expand Down Expand Up @@ -191,13 +191,13 @@ export default function Navigation({ swiper, extendParams, on, emit }) {
});

const enable = () => {
swiper.el.classList.remove(swiper.params.navigation.navigationDisabledClass);
swiper.el.classList.remove(swiper.params.navigation.navigationDisabledClass.split(' '));
init();
update();
};

const disable = () => {
swiper.el.classList.add(swiper.params.navigation.navigationDisabledClass);
swiper.el.classList.add(swiper.params.navigation.navigationDisabledClass.split(' '));
destroy();
};

Expand Down

0 comments on commit 772ce3e

Please sign in to comment.