Showing
2 changed files
with
5 additions
and
3 deletions
@@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
39 | 39 | ||
40 | {{#isEqualOr type 'marquee' 'swiper'}} | 40 | {{#isEqualOr type 'marquee' 'swiper'}} |
41 | {{! 轮播/滑动}} | 41 | {{! 轮播/滑动}} |
42 | - <div class="swiper-container {{type}}" data-loop="{{loop}}" {{#if autoplay}}data-autoplay="{{autoplay}}"{{/if}}> | 42 | + <div class="swiper-container {{type}}" data-loop="{{loop}}" {{#if spaceBetween}}data-spacebetween="{{spaceBetween}}"{{/if}} {{#if autoplay}}data-autoplay="{{autoplay}}"{{/if}}> |
43 | <div class="swiper-wrapper"> | 43 | <div class="swiper-wrapper"> |
44 | {{#list}} | 44 | {{#list}} |
45 | <div class="swiper-slide" style="{{styleFormat this percent=1}}"> | 45 | <div class="swiper-slide" style="{{styleFormat this percent=1}}"> |
@@ -10,12 +10,14 @@ function swiperInit() { | @@ -10,12 +10,14 @@ function swiperInit() { | ||
10 | $('.swiper-container').each(function() { | 10 | $('.swiper-container').each(function() { |
11 | var opt = { | 11 | var opt = { |
12 | loop: $(this).data('loop') === '1' ? true : false, | 12 | loop: $(this).data('loop') === '1' ? true : false, |
13 | - spaceBetween: 15, | ||
14 | slidesPerView: 'auto' | 13 | slidesPerView: 'auto' |
15 | }; | 14 | }; |
15 | + var spacebetween = $(this).data('spacebetween'); | ||
16 | var autoplay = $(this).data('autoplay'); | 16 | var autoplay = $(this).data('autoplay'); |
17 | var pagination = $(this).find('.swiper-pagination'); | 17 | var pagination = $(this).find('.swiper-pagination'); |
18 | - | 18 | + if (spacebetween) { |
19 | + opt.spaceBetween = Number(spacebetween); | ||
20 | + } | ||
19 | if (autoplay) { | 21 | if (autoplay) { |
20 | opt.autoplay = Number(autoplay); | 22 | opt.autoplay = Number(autoplay); |
21 | } | 23 | } |
-
Please register or login to post a comment