简体   繁体   English

HTML中的Typed.js代码不起作用

[英]Typed.js code in HTML does not work

I am trying to use typed text on my home page. 我正在尝试在主页上使用键入的文本。 I've added the html and js code and scripts but it does not work. 我已经添加了html和js代码以及脚本,但是它不起作用。 It just displays 3 of the quotes when it should be displaying one quote at a time typed out. 当应一次输入一个引号时,它仅显示三个引号。 Below is my code, any help will be appreciated. 下面是我的代码,任何帮助将不胜感激。

Index.cshtml Index.cshtml

  <div class="container"> <div class="agile_banner_info"> <div class="agile_banner_info1"> <h3>Welcome To <span>Business</span></h3> <div id="typed-strings" class="agileits_w3layouts_strings"> @*The following text should have the typing effect*@ <p>Global leaders <i>in Business Process</i> and Enterprise Content Management</p> <p>Business <i>efficiency</i> through BPM</p> <p>Increasing <i>productivity.</i> Take informed decisions</p> </div> <span id="typed" style="white-space:pre;"></span> </div> <div class="banner_agile_para"> <p>Our aim is to help our customers succeed</p> </div> <div class="wrapper-inner-tab-backgrounds"> <div class="wrapper-inner-tab-backgrounds-first"><a href="single.html"><div class="sim-button button17">Read More</div></a></div> </div> </div> </div> 

 <script src="~/Content/MyTemplate/js/typed.js" type="text/javascript"></script> <script> $(function () { $("#typed").typed({ stringsElement: $('#typed-strings'), typeSpeed: 30, backDelay: 500, loop: false, contentType: 'html', loopCount: false, callback: function () { foo(); }, resetCallback: function () { newTyped(); } }); $(".reset").click(function () { $("#typed").typed('reset'); }); }); function newTyped() { /* A new typed object */ } function foo() { console.log("Callback"); } </script> 

I added your text in the script and comment out the HTML content. 我在脚本中添加了您的文本,并注释掉了HTML内容。 Hope this will help you. 希望这会帮助你。

 $(function(){ $("#typed").typed({ strings: ["Global leaders <i>in Business Process</i> and Enterprise Content Management", "Business <i>efficiency</i> through BPM","Increasing <i>productivity.</i> Take informed decisions"], typeSpeed: 110, // typing speed backDelay: 500, // pause before backspacing loop: true, }); }); 
  <div class="container"> <div class="agile_banner_info"> <div class="agile_banner_info1"> <h3>Welcome To <span>Business</span></h3> <!-- <div id="typed-strings" class="agileits_w3layouts_strings"> @*The following text should have the typing effect*@ <p>Global leaders <i>in Business Process</i> and Enterprise Content Management</p> <p>Business <i>efficiency</i> through BPM</p> <p>Increasing <i>productivity.</i> Take informed decisions</p> </div> --> <span id="typed" style="white-space:pre;"></span> </div> <div class="banner_agile_para"> <p>Our aim is to help our customers succeed</p> </div> <div class="wrapper-inner-tab-backgrounds"> <div class="wrapper-inner-tab-backgrounds-first"><a href="single.html"><div class="sim-button button17">Read More</div></a></div> </div> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/typed.js/1.1.1/typed.min.js"></script> 

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

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