Javascript typing effect

前端 未结 6 1302
刺人心
刺人心 2020-12-31 23:28

The issue arises from the same issue as last time. My websites run off a static domain, so I want to be able to use this script on each site without making duplicate copies.

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-01 00:07

    You can embed the text in the webpage itself in a hidden element like this:

    HTML

    
    

    and then you can get the text from the webpage itself like this:

    Javascript

    var text = document.getElementById('hiddenText').innerHTML;
    

    Here is the jsfiddle you can see: http://jsfiddle.net/FMq6d/ . This makes minimal changes to your code.

提交回复
热议问题