Last active
July 8, 2018 05:09
-
-
Save cvcodes/fadf035abf6d65c3748ff469a62bdecf to your computer and use it in GitHub Desktop.
For Sololearn QnA solution used
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Component { | |
constructor(height, width, url, left, top, id) { | |
this.width = width; | |
this.height = height; | |
this.url = url; | |
this.left = left; | |
this.top = top; | |
this.id = id; | |
} | |
render() { | |
this.el = document.querySelector("img#" + this.id); | |
if(!this.el) { | |
alert('error: no ' + this.id + ' image element.'); | |
return false; | |
} | |
this.el.src = this.url; | |
this.el.style.position = 'absolute'; | |
this.el.style.left = this.left + 'px'; | |
this.el.style.top = this.top + 'px'; | |
this.el.style.width = this.width + 'px'; | |
this.el.style.height = this.height + 'px'; | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment