Last active
August 29, 2022 15:23
-
-
Save hpmartini/b0888deec249772d6ac4ab7803047bb2 to your computer and use it in GitHub Desktop.
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
const initialText = document.getElementsByClassName('notion-callout__content')[0].getElementsByTagName('h1')[0].getElementsByTagName('strong')[0].innerHTML; | |
const firstWord = initialText.split(' ')[0]; | |
let rotatorReference = document.getElementsByClassName('notion-callout__content')[0].getElementsByTagName('h1')[0].getElementsByTagName('strong')[0] | |
const rotatorWord = document.createElement('span') | |
rotatorWord.innerHTML = 'placeholder' | |
rotatorReference.appendChild(rotatorWord) | |
const words = [ | |
'test 1', | |
'test 2', | |
'test 3', | |
//'IT-Berater', | |
//'Softwarearchitekt', | |
//'Full-Stack-Entwickler', | |
//'Experte für Digitalisierung', | |
//'Experte für Single-Page-Applications' | |
]; | |
const timer = (timout) => new Promise(resolve => setTimeout(resolve, timout)); | |
const rotate = async () => { | |
while(true) { | |
for (word of words) { | |
rotatorWord.innerHTML = word | |
rotatorWord.classList.toggle('fade-text') | |
await timer(3000) | |
rotatorWord.classList.toggle('fade-text') | |
await timer(1) | |
} | |
} | |
} | |
rotate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment