簡體   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