Skip to content

JavaScript Scrolling Text

CODE:

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8" />
    <title>page</title>
    <link rel="stylesheet" type="text/css" href="1.page.css">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css">
    <style>
        body{
            padding:0;
            margin:0;
            font-family:Arial;
            color:#fff;
            background:#000;
        }
        .box{
            width:500px;
            height:30px;
            background:#9e3e00;
            position:absolute;
            top:50%;
            left:50%;
            transform:translate(-50%,-50%);
            border-radius:20px;
            box-shadow:0px 0px 20px rgba(255, 106, 0, 0.68);
        }
        #yazi{
            position:absolute;
            top:50%;
            left:50%;
            transform:translate(-50%,-50%);
            width:460px        }
    </style>
</head>
<body>
    <div class="box">
        <div id="yazi">
            JavaScript is the programming language of HTML and the Web.
        </div>
    </div>

    <script>

    KayanYazi=function(nesne,zaman){
         let yaziNesne=nesne;

        setInterval(function(){
            let yazi  = yaziNesne.innerHTML;
            let harf  = yazi.substring(0,1);
            let kalan = yazi.substring(1,yazi.length);
            kalan=kalan+harf
            yaziNesne.innerHTML=kalan;
        }, zaman);
    }

    var nesne=document.getElementById("yazi");
    KayanYazi(nesne,200);
    </script>

</body>
</html>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: