Skip to content

Commit

Permalink
fix(history): fix handling popstate on init
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Jan 23, 2023
1 parent 1d68fe4 commit 483534f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modules/history/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ export default function History({ swiper, extendParams, on }) {
}
initialized = true;
paths = getPathValues(swiper.params.url);
if (!paths.key && !paths.value) return;
if (!paths.key && !paths.value) {
if (!swiper.params.history.replaceState) {
window.addEventListener('popstate', setHistoryPopState);
}
return;
}
scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit);
if (!swiper.params.history.replaceState) {
window.addEventListener('popstate', setHistoryPopState);
Expand Down

0 comments on commit 483534f

Please sign in to comment.