Results 1 to 3 of 3

Thread: Center image xtype

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Location
    Sacramento, California
    Posts
    75
    Vote Rating
    11
      0  

    Default Unanswered: Center image xtype

    We have image xtype. Image xtype type has "centered" config item. Why in the world when setting centered to true, the most expected behavior isn't happening. That is image being centered. Not even setting layout does this.

    Code:
    layout: {
            type: 'hbox',
            align: 'center',
            pack: 'middle',
    },

  2. #2
    Sencha User jerome76's Avatar
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132
    Vote Rating
    100
      0  

    Default

    That code snippet from your panel (or container) config right? More code would be helpful to understand what you're getting at.

    I don't know why the image is not centering inside its container.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Location
    Toronto, Canada
    Posts
    92
    Answers
    20
    Vote Rating
    13
      0  

    Default

    Have you tried a CSS trick? Here is an example code that might be useful for you.
    Code:
    Ext.define('YourApp.view.ImageGallery', {    
        extend: 'Ext.Container',
        xtype: 'userImageGallery',
        requires: [
            'Ext.Img',
        ],
        
        config:{
            cls: 'galleria',
            
            items:[
                {
                    xtype: 'image',
                },
             ]
           }
    });
    Code:
    // css
    .galleria .x-img {
        background-repeat: no-repeat;
        background-size: auto 100%;
        background-position: center;
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •