Created
February 21, 2021 04:28
-
-
Save ManotLuijiu/47b88e0fbf31b80edd0aaeb87c2a83a0 to your computer and use it in GitHub Desktop.
Get elements then inject opacity from 0 to 1
This file contains hidden or 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
document.addEventListener('DOMContentLoaded', () => { | |
var myOpacity = 0; | |
var readMeter = document.getElementsByClassName('bsf-rt-display-label')[0]; | |
var readUnit = document.getElementsByClassName('bsf-rt-display-postfix')[0]; | |
var readColor = document.getElementsByClassName('bsf-rt-reading-time')[0]; | |
function MyFadeFunction() { | |
if (myOpacity < 1) { | |
myOpacity += 0.075; | |
setTimeout(function () { | |
MyFadeFunction(); | |
}, 1000); | |
} | |
document.getElementById('means__read__meter').style.opacity = myOpacity; | |
readMeter.setAttribute('prefix', 'ใช้เวลาอ่าน'); | |
readUnit.setAttribute('postfix', 'นาที'); | |
readColor.setAttribute('style', 'color: #0984e3;'); | |
} | |
MyFadeFunction(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment