【发布时间】:2019-04-05 17:34:23
【问题描述】:
这几天一直在努力,我正在尝试使用 gem "introjs-rails" 在 Rails 中创建一个导览。 https://github.com/heelhook/intro.js-rails。以下内容与指南要求的内容之间的一些区别是指南希望将“//= 要求 introjs”放入 application.js,但我收到 Javascript 错误“introJs().start();是未定义的变量”,所以我将“//= require introjs”放在“Intro.js”文件中,这似乎可以解决它。但是当我启动页面时,我仍然没有收到弹出消息。
Application.html.erb
<head>
<title>Workspace</title>
<%= stylesheet_link_tag 'introjs', 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'intro', 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
</head>
应用程序.scss
/*
*= require introjs
*= require_tree .
*= require_self
*/
Index.html.erb
<h1 data-step="1" data-intro="This is a tooltip!">This is a Tool Tip!</h1>
Intro.js
//= require introjs
introJs().start();
Introjs.css
*= require introjs
【问题讨论】:
标签: javascript ruby-on-rails ruby intro.js