【发布时间】:2016-12-19 21:58:20
【问题描述】:
我正在尝试让 bootstrap-tour 工作我使用 bootstrap-rails gem 在我的 rails 应用程序中包含 bootstrap rails。
我已经看到许多其他问题通过清除本地存储解决了我已经尝试过修复,但它没有任何结果。我的问题不同,它在到达 init 函数时抛出错误。
TypeError: tour.init is not a function at HTMLBodyElement.ideasTour
message
:
"tour.init is not a function"
stack
:
"TypeError: tour.init is not a function
我的 cofeescript 被编译为与 bootstrap tour
intros.coffee
ideasTour = ->
console.log 'function was called'
tour = new Tour({
steps:[
{
element: "#step1"
title: 'Ideas'
content: 'Ideas are the encapsulating class...'
}
{
element: "#step2"
title: "Create a new Idea"
content: 'lets create a new Idea, click on the add button to start.'
}
],
debug: true,
storage: false
})
console.log 'options set initializing...'
tour.init()
console.log 'initialized starting...'
tour.start(true)
console.log 'called start'
$ ->
$('body').on('tour', ideasTour)
我的应用程序.js
//= require jquery
//= require jquery_ujs
//= require best_in_place
//= require bootstrap
//= require bootstrap-tour
//= require turbolinks
//= require_tree .
$ = jQuery;
非常感谢任何帮助。
【问题讨论】:
标签: javascript ruby-on-rails asset-pipeline ruby-on-rails-5 bootstrap-tour