简体   繁体   English

Typed.js 不工作

[英]Typed.js is Not working

I start typed.js but ist not working and no error shown in the console我启动了 typed.js 但它不工作并且控制台中没有显示错误

$(function(){
    $('.animate-text').typed({
        strings:[
                "Muhammad Saim",
                "Programmer",
                "Web Developer",
              ],
        typeSpeed:0,
        loop:false
    });
});

Make sure the ".animate-text" element/s are already rendered before executing your script.在执行脚本之前,请确保“.animate-text”元素已经呈现。

Whenever you manipulate a DOM element , it needs to come before your javascript code.每当您操作 DOM 元素时,它都需要放在您的 javascript 代码之前。

Example that will not work :不起作用的例子:

<script> jQuery('#test').css('display','none');</script>
<div id='test'></div>

Example that will work :将起作用的示例:

<div id='test'></div>
<script> jQuery('#test').css('display','none');</script>

Use this in your script file and change the names according to you.在您的脚本文件中使用它并根据您更改名称。

var typed = new Typed('#typed', {
  strings: [
    'Aman Singh Aswal'
  ],
  typeSpeed: 50,
  backSpeed: 80,
  loop: true
});

use this in html file where you want typedjs to work.在您希望 typedjs 工作的 html 文件中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM