Skip to content

Commit 7f3fa96

Browse files
jur-ngnolimits4web
andauthored
fix(hash-navigation): handle slide to none existing hash (#6681)
* Also do an early return on a NaN value * Update hash-navigation.js --------- Co-authored-by: Vladimir Kharlampidi <[email protected]>
1 parent 0fcd210 commit 7f3fa96

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/modules/hash-navigation/hash-navigation.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ export default function HashNavigation({ swiper, extendParams, emit, on }) {
3737
const activeSlideHash = activeSlideEl ? activeSlideEl.getAttribute('data-hash') : '';
3838
if (newHash !== activeSlideHash) {
3939
const newIndex = swiper.params.hashNavigation.getSlideIndex(swiper, newHash);
40-
console.log(newIndex);
41-
if (typeof newIndex === 'undefined') return;
40+
if (typeof newIndex === 'undefined' || Number.isNaN(newIndex)) return;
4241
swiper.slideTo(newIndex);
4342
}
4443
};

0 commit comments

Comments
 (0)