From 9b66c0c1257ea52561a4f038073670b4525c9f12 Mon Sep 17 00:00:00 2001 From: TheYoungManLi Date: Wed, 16 Mar 2022 10:34:01 +0800 Subject: [PATCH] fix: Meetup slide problem Signed-off-by: TheYoungManLi --- layouts/live/list.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/layouts/live/list.html b/layouts/live/list.html index e71ec8629..ca1939bac 100644 --- a/layouts/live/list.html +++ b/layouts/live/list.html @@ -241,6 +241,7 @@ current: null, create: function () { const documentWidth = $(document).width() + const childNum = $('#swiper-wrapper').children().length const option = { autoplay: { running: true, @@ -249,11 +250,12 @@ }, delay: autoplayTime, speed: 500, - loop: true, + loop: childNum > 3 ? true : false, } if (documentWidth > 800) { option.slidesPerView = 3 option.spaceBetween = 20 + hideSlideButton(childNum <= 3) } if (documentWidth < 800) { @@ -310,6 +312,16 @@ }) } + var hideSlideButton = function (hide) { + if (hide) { + $('.prev-button').hide() + $('.next-button').hide() + } else { + $('.prev-button').show() + $('.next-button').show() + } + } + bindClickVideoTabLi() bindClickVideoLi() initVideos()