deviceone开发app的,我想点击图片滑动看,怎么实现? javascript lua html jonh_felix 4月26日提问 -问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

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

杨冬芳 2016-06-22 17:17:30 1412

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

JavaScript 前端开发
分享到
取消 提交回答
全部回答(1)
  • 杨冬芳
    2019-07-17 19:45:48
    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);
    }
    0 0
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

推荐文章
相似问题
推荐课程