press-swiper
Version:
适配多端的高自定义轮播组件,多种3D效果。全面对标swiperjs。
21 lines (20 loc) • 566 B
JavaScript
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");
})
});
}