You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
703 B
29 lines
703 B
|
3 years ago
|
export default function updateSize() {
|
||
|
|
const swiper = this;
|
||
|
|
let width;
|
||
|
|
let height;
|
||
|
|
const el = swiper.el;
|
||
|
|
if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) {
|
||
|
|
width = swiper.params.width;
|
||
|
|
} else {
|
||
|
|
width = el.width;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) {
|
||
|
|
height = swiper.params.height;
|
||
|
|
} else {
|
||
|
|
height = el.height;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) {
|
||
|
|
return;
|
||
|
|
} // Subtract paddings
|
||
|
|
if (Number.isNaN(width)) width = 0;
|
||
|
|
if (Number.isNaN(height)) height = 0;
|
||
|
|
Object.assign(swiper, {
|
||
|
|
width,
|
||
|
|
height,
|
||
|
|
size: swiper.isHorizontal() ? width : height
|
||
|
|
});
|
||
|
|
}
|