Skip to content

Commit

Permalink
feat(core): new slidesUpdated event
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed Nov 22, 2023
1 parent bb7c66f commit 8a0c7c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/update/updateSlides.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ export default function updateSlides() {
swiper.updateSlidesOffset();
}

swiper.emit('slidesUpdated');

if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) {
const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
Expand Down
4 changes: 4 additions & 0 deletions src/types/swiper-events.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export interface SwiperEvents {
*/
beforeDestroy: (swiper: Swiper) => void;

/**
* Event will be fired after slides and their sizes are calculated and updated
*/
slidesUpdated: (swiper: Swiper) => void;
/**
* Event will be fired when currently active slide is changed
*/
Expand Down
1 change: 1 addition & 0 deletions src/vue/swiper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ const Swiper = {
'scrollbarDragStart',
'setTransition',
'setTranslate',
'slidesUpdated',
'slideChange',
'slideChangeTransitionEnd',
'slideChangeTransitionStart',
Expand Down

0 comments on commit 8a0c7c4

Please sign in to comment.