开发者社区> 问答> 正文

deviceone开发app的,我想点击图片滑动看,怎么实现? javascript lua html jonh_felix 4月26日提问

在开发类似朋友圈的时候,可以点击图片的时候,左右滑动可以看到图片。如何实现?

展开
收起
杨冬芳 2016-06-22 17:17:30 3228 0
1 条回答
写回答
取消 提交回答
  • IT从业
    function init() {
            for (i = 2; i <= 7; i++) {
                    var imageview = ui("do_ImageView_" + i);
                    imageview.tag = i - 2;// 把序号记录在imageview的tag属性
                    imageview.on("touch", function() {
                            click(this);
                    })
            }
     
    }
    init();
     
    var images = [
                    {
                            source : "http://pic3.nipic.com/20090525/2416945_231841034_2.jpg",
                            init : "source://image/1.jpg"
                    },
                    {
                            source : "http://pic9.nipic.com/20100904/4845745_195609329636_2.jpg",
                            init : "source://image/2.jpg"
                    },
                    {
                            source : "http://pic1.nipic.com/2008-12-09/200812910493588_2.jpg",
                            init : "source://image/3.jpg"
                    },
                    {
                            source : "http://img.61gequ.com/allimg/2011-4/201142614314278502.jpg",
                            init : "source://image/4.jpg"
                    },
                    {
                            source : "http://hiphotos.baidu.com/praisejesus/pic/item/e8df7df89fac869eb68f316d.jpg",
                            init : "source://image/5.jpg"
                    },
                    {
                            source : "http://pic37.nipic.com/20140209/8821914_163234218136_2.jpg",
                            init : "source://image/6.jpg"
                    } ];
     
    var imageBrowser = sm("do_ImageBrowser");
     
    function click(obj) {
            imageBrowser.show(images, obj.tag);
    }
    2019-07-17 19:45:48
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
女性移动App安全攻防战 立即下载
汇聚云计算的生态核能——云市场,云上APP Store 立即下载
千万级用户直播App——服务端架构设计和思考 立即下载