简体   繁体   English

typed.js 如何使文本可编辑?

[英]typed.js how to make text editable?

I want to make the text as on the home page https://laracasts.com/我想将文本制作为主页https://laracasts.com/
use for this library https://mattboldt.com/demos/typed-js/用于此库https://mattboldt.com/demos/typed-js/
Question问题
How do I make when I click on text the animation stops and I can write my text当我单击文本时如何使 animation 停止并且我可以写我的文本
here is my code这是我的代码

 <h1>
 <span  class="header-title-accent" id="typed" contenteditable="true" spellcheck="false" > Front-end Developer</span>
</h1>
<script>
              $('document').ready(function(){
                var typed = new Typed('#typed', {
                    strings: ['First ^1000 sentence.', 'Second sentence.'],
                    backSpeed:50,
                    typeSpeed:60,
                    cursorChar: '|||',                       
                });
            });
          </script>

You could create 2 listeners on the input field to start() & stop() the Typed instance on blur & focus respectively.您可以在输入字段上创建 2 个侦听器,分别在blurfocusstart()stop()类型化实例。 See the docs for more info: https://mattboldt.github.io/typed.js/docs/#typed有关更多信息,请参阅文档: https://mattboldt.github.io/typed.js/docs/#typed

Example:例子:

$('#typed').on('focus', function(e) {
  typed.stop();
});
   
// You may not need/want this one...
$('#typed').on('blur', function(e) {
  typed.start();
});

Codepen密码笔

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

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