尝试将Swiper.js实现为tbody标签

时间:2019-02-18 17:21:22

标签: html twitter-bootstrap swiper

我需要在不影响<tbody>内部内容的情况下自动刷<thead>,但是在实现它时遇到了问题。我无法放置swiper-wrapper类,因为HTML不允许<div>标签放在表中,并且Swiper.js本身不允许swiper-wrapperswiper-slide类内联,因为它将破坏布局。

有什么解决办法吗?请看一下我的代码。

<div class="table-responsive">
    <table class="table table-auto-swiped">
        <thead>
            <!-- there will be 5 <th> element inside this tag -->
        </thead>
        <tbody class="swiper-wrapper swiper-slide font-weight-bold">
            <!--
               there will be 10 rows of data to display for each swiper-slide class
               and it will be swiped using autoplay feature provided by Swiper.

               but it does not allow swiper-slide class to be inlined with the
               swiper-wrapper class, the layout will be messed up.
             -->
        </tbody>
    </table>
</div>
<script>
  var autoSwipeTable = new Swiper.default('.table-auto-swiped', {
    //
  })
</script>

0 个答案:

没有答案