Clear Up
SharpKit Reference

Img Class

Simple helper class for easily creating image components. This renders an image tag to the DOM with the configured src.

Example usage:

  
var changingImage = Ext.create('Ext.Img', {
            src: 'http://www.sencha.com/img/20110215-feat-html5.png',
            renderTo: Ext.getBody()
            });
            // change the src of the image programmatically
            changingImage.setSrc('http://www.sencha.com/img/20110215-feat-perf.png');
            

By default, only an img element is rendered and that is this component's primary element. If the Ext.AbstractComponent.autoEl property is other than 'img' (the default), the a child img element will be added to the primary element. This can be used to create a wrapper element around the img.

Wrapping the img in a div:

  
var wrappedImage = Ext.create('Ext.Img', {
            src: 'http://www.sencha.com/img/20110215-feat-html5.png',
            autoEl: 'div', // wrap in a div
            renderTo: Ext.getBody()
            });
            

Namespace: Ext

Constructors

Fields

Name Description
alt The descriptive text for non-visual UI description. Defaults to: ""
imgCls Optional CSS classes to add to the img element. Defaults to: ""
src The image src. Defaults to: ""

Methods

Name Description
setSrc(JsString) Updates the src of the image.
© Copyright 2005-2011 SharpKit. All rights reserved.