I had a little trouble the other day, but soon it was settled. The reason to write it down is that as a front-end programmer, it is important to understand the order in which pages are loaded. Or you could write your own program unexpectedly. bug~~
Just started to write the use of append, using the Firebug of Firefox to view the element class inside the swiper-slide is still there, but the carousel does not have a dynamic effect. There are five carousel data in the database .....
The first load order must be understood:
Here is my JS code
1$(function(){2Showcarousel ();//Carousel Dynamic Data3 });4 /*** 5 * * * date:2017/01/096 * * * * Author:black_jay Astrid7 * * * Function: Carousel Dynamics (requires attention to load order)8 ***/9 functionShowcarousel () {Ten //var str001 = ' ' One $.ajax ({ A URL: ", -Type: ' Post ', -DataType: ' JSON ', theSuccessfunction(data) { - for(vari = 0; i < data.length; i + + ) { - varURL =Data[i]. URL; - varImage =Data[i]. Image; + Lunbo (url,image); - } + //$.parser.parse (str001); A varMyswiper =NewSwiper (' #slide ',{ atPagination: '. Pagination ', -Slidesperview:1, -Paginationclickable:true, -Preloadimages:false, -Lazyloading:true, -autoplay:5000, inAutoplaydisableoninteraction:false, -Looptrue to }); + } - }); the functionLunbo (url,image) { *$ ("#showCarousel"). Append ("<div class= ' swiper-slide ' >" $+ "<a href=" "+url+" > "Panax Notoginseng+ " -+ "</a>" the+ "</div>"); + } A}
Presumably this loading order can be solved.
The analysis of the loading order of the page, the future work encountered problems. In the discussion with everyone ... ~
Append loading Dynamic Carousel