Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Add height/width params.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Nov 6, 2014
1 parent 4c3fe6e commit 5a0c2c1
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion core-image.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,42 @@
* @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

},

observe: {
'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;
Expand Down

0 comments on commit 5a0c2c1

Please sign in to comment.