will-change.js 566 B

1234567891011121314151617181920
  1. export default function WillChange({
  2. swiper,
  3. extendParams,
  4. on
  5. }) {
  6. on('setTransition', (s, duration) => {
  7. if (!swiper.params.willChange) return;
  8. if (swiper.params.effect == "slide" || swiper.params.effect == "cube" || swiper.params.effect ==
  9. "coverflow" || swiper.params.effect == "panorama") {
  10. swiper.$wrapperEl.willChange("transform");
  11. }
  12. });
  13. on('transitionEnd', (s, duration) => {
  14. if (!swiper.params.willChange) return;
  15. swiper.$wrapperEl.willChange("auto");
  16. swiper.slides.forEach((item) => {
  17. item.$itemEl.willChange("auto");
  18. })
  19. });
  20. }