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