猿问

angular里面如何使用swiper插件?

angular 里面无法使用滑动插件

<!-引入swiper样式 -->

<link rel="stylesheet" href="swiper.min.css" media = "all">


<!-- 引入swiper插件 -->

<script type="text/javascript" src = "swiper.min.js"></script>

 <script type="text/javascript">

        var mySwiper = new Swiper('.swiper-container',{

    autoplay:2500,

    loop:true,

    autoplayDisableOnInteraction:false,

    pagination : '.swiper-pagination',

    paginationClickable: true,

    longSwipesRatio: 0.3,

    touchRatio:1,

    observer:true,//修改swiper自己或子元素时,自动初始化swiper

    observeParents:true,//修改swiper的父元素时,自动初始化swiper

})

 </script>

 <div id="test"></div>

   <div id="log_window">

   <div class="swiper-container">

    <div class="swiper-wrapper">

        <div class="swiper-slide">Slide 1</div>

        <div class="swiper-slide">Slide 2</div>

        <div class="swiper-slide">Slide 3</div>

       

    </div>

    <!-- Add Pagination -->

    <div class="swiper-pagination"></div>

</div>


</div>


慕森卡
浏览 608回答 1
1回答

泛舟湖上清波郎朗

可以用 初始化的时候加载一次&nbsp;<li ng-repeat="item in prodList" repeat-done="showAll()"></li>.directive('repeatDone',function(){&nbsp; &nbsp; return{&nbsp; &nbsp; &nbsp; &nbsp; link:function(scope,element,attrs){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(scope.$last){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; scope.$eval(attrs.repeatDone);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; }})
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答