繁体   English   中英

Sencha Touch:如何通过单击隐藏图像

[英]Sencha Touch: how can I hide an image with a click

我在Sencha Touch 2中遇到问题。我想在单击其他图像时隐藏图像。 我怎样才能做到这一点?

items: [{
  xtype: 'panel',
  html: '<img class="logo0" src="http://localhost/PlanningPoker/resources/images/carte0.png" /> '+
        '<img class="logo1" src="http://localhost/PlanningPoker/resources/images/carte1.png" /> ',
  listeners: [{
    element: 'element',
    delegate: 'img.logo0',
    event: 'tap',
    fn: function() {
      console.log('One!');
    }
  },
  {
    element: 'element',
    delegate: 'img.logo1',
    event: 'tap',
    fn:function() {
      console.log('Two!');
    }
  }]
}]

干得好

Ext.Loader.setConfig({
    enabled : true
});

Ext.application({
    name : ('SF' || 'SenchaFiddle'),

    launch : function() {
        Ext.create('Ext.Panel', {
            fullscreen : true,
            items: [{
                xtype: 'panel',
                html: '<img class="logo0" src="http://25.media.tumblr.com/avatar_71ef465a7108_64.png" /><img class="logo1" src="http://existdissolve.com/wp-content/uploads/2010/08/sencha-logo-64x64.png" /> ',
                listeners: [{
                    element: 'element',
                    delegate: 'img.logo0',
                    event: 'tap',
                    fn: function() {
                        Ext.DomQuery.select('img.logo1')[0].style.display = 'none';
                    }
                }, {
                    element: 'element',
                    delegate: 'img.logo1',
                    event: 'tap',
                    fn:function() {
                        Ext.DomQuery.select('img.logo0')[0].style.display = 'none';
                    }
                }]
            }]
        });
    }
});

希望这可以帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM