Results 1 to 3 of 3

Thread: When I add center:true, the image does not show

  1. #1

    Default Answered: When I add center:true, the image does not show

    I try to dynamically add image to a carousel view.

    code is like this:
    var image=Ext.create('Ext.Img',{src:rcd.imgURL,centered:true});
    items.push(image);

    var mainPanel=this.getMain();
    var carouselView = Ext.create('LifeAtRIM.view.HtmlCarouselView');
    carouselView.setItems(items);
    carouselView.setActiveItem(0);
    mainPanel.push(carouselView);

    if I don't have centered:true , everything works fine. But when I add centered:true , those images disappeared.

    Thanks,

  2. If you want to center your images, you should use CSS.

    Try this code:

    Code:
    var image=Ext.create('Ext.Img',{src:rcd.imgURL, cls:'carouselcenter'});
    Code:
    .carouselcenter {
            background-position: center;
    }

  3. #2
    Sencha User
    Join Date
    Apr 2012
    Posts
    103
    Answers
    5

    Default

    If you want to center your images, you should use CSS.

    Try this code:

    Code:
    var image=Ext.create('Ext.Img',{src:rcd.imgURL, cls:'carouselcenter'});
    Code:
    .carouselcenter {
            background-position: center;
    }

  4. #3

    Default

    Thanks.

Posting Permissions

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