Last active
December 11, 2023 17:54
-
-
Save ihorduchenko/58f5708e5f11c31794530891dc8e4e54 to your computer and use it in GitHub Desktop.
Get instance of Swiper from DOM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example shows us how to update broken swiper after Fancybox carousel closing | |
if (typeof fancyboxInit !== undefined) { | |
// Main approach here is the next row | |
$.fancybox.defaults.backFocus = false; | |
let showCaseSlider = $('.showCaseSlider .swiper-container'); | |
$('[data-fancybox]').fancybox({ | |
afterClose: function() { | |
if (showCaseSlider) { | |
let showCaseSliderInstance = showCaseSlider[0].swiper; | |
showCaseSliderInstance.update(); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you using typescipt. you can do: