You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two swipers, one with pictures, the other with thumbs. Thumbs are more than pictures.
On the "slideChangeTransitionStart" event, I remove the -active, -prev, -next classes from all thumbs and hang them on those that I need. I registered centeredSlides: true and controller by container in the parameters.
I am unable to center the new active slide. Tracking on other events is not suitable. I need to update the slider parameters after assigning a new active thumb, does anyone know how this can be done? or maybe there is another way? I would be grateful for any help.
`historySlider.on("slideChangeTransitionStart", function () {
// Get the active-slide when slide is changing
let activeHistoryImage = document.querySelector(".history__slide.swiper-slide-active");
// Get the active-slide data-slide attribute
let activeHistoryImageAttr = activeHistoryImage.getAttribute("data-slide");
let historyTimestamp = document.querySelectorAll(".history__stamp");
// Get the cycle from timeline row
historyTimestamp.forEach(item => {
if (item.dataset.target == activeHistoryImageAttr) {
let activeTimestamp = item;
// Remove from any timeline slide active class
historyTimestamp.forEach(elem => {
elem.classList.remove("swiper-slide-active");
});
// Remove from any timeline slide prev class
historyTimestamp.forEach(elem => {
elem.classList.remove("swiper-slide-prev");
});
// Remove from any timeline slide next class
historyTimestamp.forEach(elem => {
elem.classList.remove("swiper-slide-next");
});
// Add active class to activeTimestamp, previous to previous and next to next
activeTimestamp.classList.add("swiper-slide-active");
activeTimestamp.previousElementSibling.classList.add("swiper-slide-prev");
activeTimestamp.nextElementSibling.classList.add("swiper-slide-next");
This discussion was converted from issue #5129 on October 25, 2021 19:42.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Good day.
There are two swipers, one with pictures, the other with thumbs. Thumbs are more than pictures.
On the "slideChangeTransitionStart" event, I remove the -active, -prev, -next classes from all thumbs and hang them on those that I need. I registered centeredSlides: true and controller by container in the parameters.
I am unable to center the new active slide. Tracking on other events is not suitable. I need to update the slider parameters after assigning a new active thumb, does anyone know how this can be done? or maybe there is another way? I would be grateful for any help.
`historySlider.on("slideChangeTransitionStart", function () {
// Get the active-slide when slide is changing
let activeHistoryImage = document.querySelector(".history__slide.swiper-slide-active");
// Get the active-slide data-slide attribute
let activeHistoryImageAttr = activeHistoryImage.getAttribute("data-slide");
let historyTimestamp = document.querySelectorAll(".history__stamp");
// Get the cycle from timeline row
historyTimestamp.forEach(item => {
if (item.dataset.target == activeHistoryImageAttr) {
let activeTimestamp = item;
}
});`
Beta Was this translation helpful? Give feedback.
All reactions