-2

使用 carousel 创建给定格式的 ajava 脚本数组?

我正在使用 carousel.js 和 carousel.css,它可以很好地处理静态数据,但是当我尝试放置动态数据时,它会发生热点。我无法以给定格式创建值数组。

   <script>
                  var carousel2 = new widgets.Carousel( {

                        uuid : "carousel2",
                        widgetDir : "carousel/",
                        args : { "theme" : "gray", "scrollCarousel" : true, },
                        value : [


                           { 
                             "image" : "images/banner/big_banner_01.jpg",

                           },

                           { 
                             "image" : "images/banner/big_banner_02.jpg",

                           },

                           {
                             "image" : "images/banner/big_banner_03.jpg",

                             },

                           { 
                              "image" : "images/banner/big_banner_04.jpg",

                           },

                           { 
                              "image" : "images/banner/big_banner_05.jpg",

                           }
                        ]
                      } );
                </script>


      I need to pass the value for "value" key dynamically.  How can i form this dynamically .IM TRYING WITH THE BELOW ONE

        <repeat index="index.value" ref="DATA">
        <repeat ref="VAL">
            <choose ref="LANGUAGE">
                <when value="${lang}">hiii
                    <script>
                    val[index.value] = "{"+"'image' :" +${IMAGE}+"}";</script>
                </when>
                <otherwise/>
            </choose>
        </repeat>
    </repeat>


    This is not working.
4

1 回答 1

0

<script>
  var generateCaroseul = {

            getData: function(){

                //loop through html to create an object with the data.
                var dataObj = null;
                $('li').each(function(index) {
                    var imgUrl = $(this).attr("src");
                    dataObj.add("image", imgUrl);
                });

                return dataObj;
            }
  };


  var carousel2 = new widgets.Carousel( {

        uuid : "carousel2",
        widgetDir : "carousel/",
        args : { "theme" : "gray", "scrollCarousel" : true, },
        value : generateCaroseul.getData()
      } );
</script>

于 2012-11-05T13:05:49.100 回答