简体   繁体   English

Rails:我在使用JavaScript和Rails时遇到问题。 如何使typist.js正常工作?

[英]Rails: I'm having issues with javascript and rails. How do I get typist.js to work?

I tried get typist.js to work but I'm having a difficult time as it doesn't seem to do anything. 我试图让typist.js正常工作,但是我似乎很难做,因为它似乎无能为力。 Here are the steps I took to get it to work. 这是我为使其正常工作所采取的步骤。

https://github.com/positionly/Typist https://github.com/positionly/Typist

typist.js in the javascript folder javascript文件夹中的typist.js

application.js application.js

//= require typist

show.html.erb show.html.erb

JavaScript is <strong id="typist-element" data-typist="ugly,not as good an CoffeeScript">great</strong>

applications.css applications.css

.selectedText {
  background: #f00;
}

but nothing happens, it doesn't do anything. 但什么也没发生,它什么也没做。 How do I get it working? 我该如何运作?

You have to run the javascript, as it says in the docs. 您必须运行javascript,如文档中所述。 In coffeescript: 在咖啡脚本中:

typist = document.querySelector "#typist-element" new Typist typist, letterInterval: 60 textInterval: 3000

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

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