Skip to content

Commit

Permalink
fix(history): fix setting history in virtual slides
Browse files Browse the repository at this point in the history
fixes #7327
  • Loading branch information
nolimits4web committed Feb 27, 2024
1 parent 829a253 commit d4de17b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/history/history.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ export default function History({ swiper, extendParams, on }) {
} else {
location = window.location;
}
const slide = swiper.slides[index];
const slide =
swiper.virtual && swiper.params.virtual.enabled
? swiper.slidesEl.querySelector(`[data-swiper-slide-index="${index}"]`)
: swiper.slides[index];
let value = slugify(slide.getAttribute('data-history'));
if (swiper.params.history.root.length > 0) {
let root = swiper.params.history.root;
Expand Down

0 comments on commit d4de17b

Please sign in to comment.