diff --git a/core-image.html b/core-image.html index 7f652f1..6693436 100644 --- a/core-image.html +++ b/core-image.html @@ -159,7 +159,27 @@ * @type boolean * @default false */ - loading: false + loading: false, + + /** + * Can be used to set the width of image (e.g. via binding); size may also be + * set via CSS. + * + * @attribute width + * @type number + * @default null + */ + width: null, + + /** + * Can be used to set the height of image (e.g. via binding); size may also be + * set via CSS. + * + * @attribute height + * @type number + * @default null + */ + height: null }, @@ -167,6 +187,14 @@ 'preload color sizing position src fade': 'update' }, + widthChanged: function() { + this.style.width = isNaN(this.width) ? this.width : this.width + 'px'; + }, + + heightChanged: function() { + this.style.height = isNaN(this.height) ? this.height : this.height + 'px'; + }, + update: function() { this.style.backgroundSize = this.sizing; this.style.backgroundPosition = this.sizing ? this.position : null;