JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html lang="de">
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <header id="header">+++ Aktuelle News, Veranstalltungen und das Thema des nächsten Übungsabends +++</header>
        <script src="functions.js"></script>
    </body>
</html>

CSS

html{
    width: 100%;
    overflow: hidden;
}

body{
    height: 100%;
    width: 100%;
    position: relative;
    display: block;
    margin: 0;
    padding: 0;
    top: 50vh;
    transform: translateY(-50%);
    color: black;
    background-color: #bbc8d9;
}

header{
    font-family: calibri, arial;
    font-weight: 400;
    font-size: 100px;
    white-space: nowrap;
}

JavaScript

function setStaticData() {
    sessionStorage.setItem('headerWidth', document.getElementById('header').scrollWidth);
}

function getStaticData() {
    return sessionStorage.getItem('headerWidth');
}

function animation() {
    
    //get element, its width & time param
    var header = document.getElementById('header');
    var headerWidth = getStaticData();
    var headerTime = header.innerHTML.length * 0.3;
    var windowWidth = window.innerWidth;
    
    //clean all
    header.style.transition = 'none';
    header.style.marginLeft = windowWidth+'px';
    
    alert("baba");
    
    //animate text
    header.style.transition = 'margin linear '+headerTime+'s';
    header.style.marginLeft = '-'+headerWidth+'px';    
    
    //wait and repeat
    var delay = headerTime * 1000 + 1000;
    setTimeout(animation, delay);
}

//first call
window.onload = function (){
    setStaticData();
    animation();
};