刚开始写利用Append的时候,利用火狐的firebug查看元素class里面swiper-slide还在,可是轮播的时候没有动态的效果。数据库里有轮播的五条数据。。。。。
1 $(function(){
2 showCarousel();//轮播动态数据
3 });
4 /***
5 * ** Date: 2017/01/09
6 * ** Author: Black_Jay郗
7 * ** Function: 轮播动态 (需要注意加载顺序)
8 ***/
9 function showCarousel(){
10 //var str001 = ‘‘
11 $.ajax({
12 url: ‘’,
13 type: ‘Post‘,
14 dataType: ‘json‘,
15 success: function(data) {
16 for ( var i = 0 ; i ) {
17 var url = data[i].Url;
18 var image = data[i].Image;
19 lunbo(url,image);
20 }
21 //$.parser.parse(str001);
22 var mySwiper = new Swiper(‘#slide‘,{
23 pagination: ‘.pagination‘,
24 slidesPerView: 1,
25 paginationClickable: true,
26 preloadImages: false,
27 lazyLoading: true,
28 autoplay: 5000,
29 autoplayDisableOnInteraction: false,
30 loop: true
31 });
32 }
33 });
34 function lunbo(url,image){
35 $("#showCarousel").append(""
36 +""
37 +"
"
38 +""
39 +"
");
40 }
41 }