|
楼主 |
发表于 2016-8-6 23:36:31
|
显示全部楼层
你好,我做的图片轮播中可以自动播放,可是有两个问题没弄好:1.播放的图片跟轮播控制条中的圆点顺序不对应,第一个圆点里面没有图片,第二个圆点对的是第一张图片,最后一张图片没有圆点对应
2.点击圆点没有事件发生,不会换图
源码部分:
- <div style="height:250px;border-radius:10px 10px 10px 10px;" xid="div4" class="x-list col-xs-4 col-sm-4">
- <div component="$UI/system/components/bootstrap/carousel/carousel" class="x-carousel " xid="carousel2" auto="true" interval="10" style="border-radius:10px;">
- <ol class="carousel-indicators" xid="ol2" style="position:absolute;bottom:0px;top:230px;left:284px;"></ol>
-
- <div class="x-contents carousel-inner" role="listbox" component="$UI/system/components/justep/contents/contents" active="0" slidable="true" wrap="true" swipe="true" routable="false" xid="contentsImg" style="border-radius:10px" onActiveChanged="contentsImgActiveChanged">
- <a xid="a8" class="carousel-control" style="border-radius:0px 0px 10px 10px;bottom:0px;background-color:#C2A30E;width:100%;height:10%;top:225px;"></a></div><a class="left carousel-control" role="button" xid="a3" bind-visible="false" style="border-radius:10px 0px 0px 10px;">
- <span class="glyphicon glyphicon-chevron-left" aria-hidden="true" xid="span22"></span>
- <span class="sr-only" xid="span23">Previous</span></a>
- <a class="right carousel-control" role="button" xid="a4" bind-visible="false" style="border-radius:0px 10px 10px 0px;">
- <span class="glyphicon glyphicon-chevron-right" aria-hidden="true" xid="span24"></span>
- <span class="sr-only" xid="span25">Next</span></a>
- <a xid="a6" class="carousel-control" style="font-family:黑体;font-size:medium;top:inherit;left:inherit;">更多</a>
- </div>
- <div component="$UI/system/components/justep/list/list" class="x-list pull-left center-block carousel-control" xid="list2" data="leaftitledata" style="border-radius:10px 10px 0px 0px;top:0px;height:30px;background-color:#DEDEDE;left:inherit;width:93%;" autoLoad="true">
- <ul class="x-list-template x-min-height" xid="listTemplateUl3" componentname="$UI/system/components/justep/list/list#listTemplateUl" id="undefined_listTemplateUl3">
- <li xid="li2" class="x-min-height" componentname="li(html)" id="undefined_li2"><div component="$UI/system/components/justep/output/output" class="x-output pull-left" xid="output1" bind-ref='ref("fName")' style="border-radius:10px 10px 0px 0px;"></div></li></ul> </div>
- </div>
复制代码
js代码:
- Model.prototype.leafdataCustomRefresh = function(event){
- var leafdata = this.comp("leafdata");
- console.log(this.comp("leafdata").toJson());
- var self = this;
- var carousel = this.comp("carousel2");
- leafdata.each(function(obj) {
- var ficon = obj.row.val("fIcon");
- var fid = obj.row.val("fID");
- var fname = obj.row.val("fName");
- if (self.comp('contentsImg').getLength() > obj.index) {
- var fviconUrl = self.getviconUrl(ficon, fid);
- $(carousel.domNode).find("img").eq(obj.index).attr({"src" : fviconUrl});
- if (obj.index === 0) {
- var fviconUrl = self.getviconUrl(ficon, fid);
- $(carousel.domNode).find("img").eq(0).attr({"src":fviconUrl});
- }
- } else {
- var fviconUrl = self.getviconUrl(ficon, fid);
- console.log(fviconUrl);
- carousel.add('<img src="' + fviconUrl + '" name="'+obj.index+'" class="image-wall" height="250px" style="width:100%;border-radius:10px 10px 10px 10px;" bind-click="openPageClick"/>');
- }
- });
-
- };
复制代码 |
|