Marketing rewriting of the last word in a sentence

Hello, I would like to use an inscription where the last word will be transcribed to a different meaning of the sentence.

Please do you have a solution, bric or template to use last word rewriting?

For example:
Design can be divine
Design can be nice
Design can be innovative

I created the HTML5 code for .php in ChatGPT and added it to the Blocs project via the Code Widget. The code in the live preview in Blocs works and the last word is overwritten, unfortunately it no longer works after uploading to the FTP server (maybe I have something wrongly set up in the export).

HTML code: https://eldar.2one.cz/HTML_code_text.rtf
Blocs format: https://eldar.2one.cz/2one.cz_2023.bloc

Website: https://2one.cz/

Thank You, Izzy Cooper

<!DOCTYPE html>
<html>
<head>
    <title>KouzlenĂ­ s marketingem</title>
</head>
<body>
    <p id="prepisujiciText">Design můŞe být boŞí!</p>

    <script>
        var slova = ["kreativnĂ­", "inovativnĂ­", "oslnivĂ˝", "zajĂ­mavĂ˝"];
        var slovoIndex = 0;
        var textElement = document.getElementById("prepisujiciText");
        var slovo = slova[slovoIndex];
        var pismenoIndex = 0;
        var cekaniPoSlovu = 1500; // 1 sekundy
        var zmenaSlovaInterval = 4000; // 4 sekund

        function prepisujPismeno() {
            if (pismenoIndex < slovo.length) {
                var novaVeta = textElement.textContent;
                novaVeta = novaVeta.slice(0, novaVeta.lastIndexOf(" ") + 1) + slovo.substring(0, pismenoIndex + 1);
                textElement.textContent = novaVeta;
                pismenoIndex++;
            } else {
                setTimeout(function() {
                    pismenoIndex = 0;
                    slovo = slova[slovoIndex];
                }, cekaniPoSlovu);
            }
        }

        function zmenSlovo() {
            slovoIndex = (slovoIndex + 1) % slova.length;
            slovo = slova[slovoIndex];
        }

        setInterval(prepisujPismeno, 100); // Měňte písmeno rychle
        setInterval(zmenSlovo, zmenaSlovaInterval); // Změňte slovo každých 5 sekund
    </script>
</body>
</html>

Although you can use ChatGPT to help with code, you still need to understand what it’s doing, because 1. It often needs correction, 2. You have code you don’t need if you’re using a code widget in Blocs, like the code above. You only need the Div with the ID, and add the script to the page footer. There are a few threads already in the forum for achieving this in JavaScript.

1 Like