我是东山呀 2021-06-06 15:55 采纳率: 0%
浏览 188

Cannot read property 'substr' of undefined?

网站使用typed.js打字特效,出现一下问题

报错信息:

(index):473 [span#typed]0: span#typedlength: 1__proto__: Array(0)
(index):474 [div#typed-strings]

typed.js@2.0.12:10 Uncaught TypeError: Cannot read property 'substr' of undefined
    at t.value (typed.js@2.0.12:10)
    at typed.js@2.0.12:10

HTML:

<div class="type-wrap">
      <div id="typed-strings" style="display: none"></div>

      <span id="typed"></span>
</div>

script代码:

    // 动态打字效果
    console.log(jQuery.find("#typed"))
    console.log(jQuery.find("#typed-strings"))
    var typed = new Typed('#typed', {
        stringsElement: document.getElementById("typed"),
        typeSpeed: 100, //打字速度
        startDelay: 1000,//开始之前的延迟1000毫秒
        //用淡出代替退格(必须使用CSS类)
        fadeOut: true,
        fadeOutClass: 'typed-fade-out',
        fadeOutSpeed: 3000, //衰减速度:500,//毫秒
        loop: true,// 开启循环
        loopCount: null, // 循环次数 null为无限
     })

这个问题如何解决?时不时的给我来一下,就是找不出病根。。。

 

  • 写回答

2条回答 默认 最新

  • CSDN专家-sinJack 2021-06-06 16:00
    关注

    偶尔报错吗?可能这个typed.js不稳定。

    评论

报告相同问题?

悬赏问题

  • ¥20 python忆阻器数字识别
  • ¥15 无法输出helloworld
  • ¥15 高通uboot 打印ubi init err 22
  • ¥20 PDF元数据中的XMP媒体管理属性
  • ¥15 R语言中lasso回归报错
  • ¥15 网站突然不能访问了,上午还好好的
  • ¥15 有没有dl可以帮弄”我去图书馆”秒选道具和积分
  • ¥15 semrush,SEO,内嵌网站,api
  • ¥15 Stata:为什么reghdfe后的因变量没有被发现识别啊
  • ¥15 振荡电路,ADS仿真