Obtaining dynamic data rendered FIG rotation (Banner)

In an example of FIG bootstrap carousel;

html part:

            <div id="carousel-example-generic" class="carousel slide banner-wrap" data-ride="carousel">
                <ol class="carousel-indicators banner-indicators">
                  
                </ol>
                <div class="carousel-inner banner-carousel" role="listbox">
                
                </div>
            </div>

JS part: here it is critical to put the code, where a determination is bannerData parameters There are no pictures of background data

               If you do not picture the carousel map hidden, otherwise rendered;

            IF (bannerData.length == 0) {
                $ ( "Banner-wrap."). addClass ( "hide");.
            } the else {
// FIG rotation number (i.e., under the small dots)
                for (var I 0 =; I <bannerData.length; I ++) {
                    IF (I == 0) {// need to add as the first Active
                        . $ (. "Banner-Indicators") the append ( "<Data-target = Li ' # Carousel-Example-Generic 'Data-Slide-to =' 0 'class =' Active '</ Li> ")
                    } the else {
                        $ (." Banner-Indicators "). the append (" <Li Data-target =' # carousel-example-generic 'data -slide-to =' "+ i +" '> </ li> ")
                    }
                }
// FIG rotation number of sheets
                for (var i = 0; i <bannerData.length; i ++) {
                      if (i == 0) {// need to add as the first Active
                        $ (. "Banner-Carousel"). the append ( '<div class = "Item Active">' +
                        '<IMG the src = "' + bannerData [i] .source + ' " alt =" ad FIG ">' +
                          '</ div>'
                          );
                    } the else {
                        . $ (" Banner-Carousel. ") the append ( '<div class =" Item ">' +
                        '<IMG the src = "' + bannerData [I] .source + '" Alt = "FIG ads">' +
                          '</ div>'
                          );
                   }

                }
            }

OK, and like a little bit concerned about the yo-partners may welcome message

Guess you like

Origin blog.csdn.net/weixin_41760500/article/details/82965087