第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

我需要整個(gè)類型的書(shū)寫文本在頁(yè)面上停留一段時(shí)間,然后在第二個(gè)循環(huán)中消失

我需要整個(gè)類型的書(shū)寫文本在頁(yè)面上停留一段時(shí)間,然后在第二個(gè)循環(huán)中消失

猛跑小豬 2023-10-20 16:23:04
1 . 一旦在第二個(gè)循環(huán)之前完全寫入,我需要將整個(gè)類型的寫入文本保留在顯示屏上。請(qǐng)?jiān)谖业拇a上應(yīng)用該解決方案。2 . 其次,在我的文本字符串中,當(dāng)我使用“b”或“strong”標(biāo)簽使特定文本變?yōu)榇煮w時(shí),“<”符號(hào)在鍵入過(guò)程中會(huì)顯示幾毫秒,所有其他標(biāo)簽也會(huì)發(fā)生同樣的情況。我不知道我的代碼有什么問(wèn)題。下面是我的代碼。for (let i = 0; i < 10; i++) {  task(i);}function task(i) {  setTimeout(function() {    // Add tasks to do     var typeString = ['? I m Mr.Frits.\n? and   I <b>love </b> Pakistan...:)'];    var i = 0;    var count = 0    var selectedText = '';    var text = '';        (function type() {      if (count == typeString.length) {        count = 0;      }      selectedText = typeString[count];      text = selectedText.slice(0, ++i);      document.getElementById('typing').innerHTML = text.fontsize(6);      document.getElementById('typing').style.fontFamily = "monospace";      document.getElementById("typing").style.color = "black";      document.getElementById("typing").style.fontWeight = "normal";      if (text.length === selectedText.length) {        count++;        i = 0;      }      /* SOLUTION : wait two seconds when new line */      if (typeString[0][i - 1] == '\n') {        setTimeout(type, 1000);      } else {        setTimeout(type, 100);      }    }());  }, 1000);}<pre id="typing"></pre>
查看完整描述

1 回答

?
喵喵時(shí)光機(jī)

TA貢獻(xiàn)1846條經(jīng)驗(yàn) 獲得超7個(gè)贊

由于計(jì)數(shù)設(shè)置為1一旦達(dá)到字符串末尾的長(zhǎng)度,因此您可以添加條件并增加超時(shí)(如果滿足):


/* SOLUTION : wait two seconds when new line */

if (typeString[0][i - 1] == '\n') {

    setTimeout(type, 1000);

} else if (count === 1) {

    setTimeout(type, 3000);

} else {

    setTimeout(type, 100);

}

使用<br />'s 時(shí),瀏覽器不會(huì)將其注冊(cè)為有效的 HTML,直到標(biāo)記完成。因此,有一秒鐘,所有渲染的內(nèi)容都是<在標(biāo)簽的其余部分完成并且它理解該標(biāo)簽是什么之前。

for (let i = 0; i < 10; i++) {

  task(i);

}


function task(i) {

  setTimeout(function() {

    // Add tasks to do 

    var typeString = ['? I m Mr.Frits.\n? and   I love  Pakistan...:)'];

    var i = 0;

    var count = 0;

    var selectedText = '';

    var text = '';

    var typing = document.getElementById('typing');


    (function type() {

      if (count == typeString.length) {

        count = 0;

      };


      selectedText = typeString[count];

      text = selectedText.slice(0, ++i);

      typing.innerHTML = text.fontsize(6);

      typing.style.fontFamily = "monospace";

      typing.style.color = "black";

      typing.style.fontWeight = "normal";


      if (text.length === selectedText.length) {

        count++;

        i = 0;

      }


      /* SOLUTION : wait two seconds when new line */

      if (typeString[0][i - 1] == '\n') {

        setTimeout(type, 1000);

      } else if (count === 1) {

        setTimeout(type, 3000);

      } else {

        setTimeout(type, 100);

      }

    }());

  }, 1000);

}

<pre id="typing"></pre>


查看完整回答
反對(duì) 回復(fù) 2023-10-20
  • 1 回答
  • 0 關(guān)注
  • 177 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)