Created
March 29, 2019 11:05
-
-
Save XianYeeXing/5ce0c19e7b08587a2b09dd8fcaa23462 to your computer and use it in GitHub Desktop.
Example of updating dom style
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
let _el = null; | |
const _getEl = sel => { | |
if(_el === null) { | |
_el = document.querySelector(sel); | |
} | |
return _el; | |
} | |
module.exports = opts => { | |
const el = _getEl(); | |
el.setAttribute('src', opts.src); | |
el.style.left = opts.left; | |
el.style.top = opts.top; | |
el.style.width = opts.width; | |
el.style.height = opts.height; | |
///el.style.display = 'block'; | |
return el; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment