如何设置'bootstrap tour'在Ruby on Rails

how to setup 'bootstrap tour' in Ruby on Rails

本文关键字:tour Ruby on Rails bootstrap 何设置 设置      更新时间:2023-09-26

我使用了bootstrap-tour.min.css和bootstrap-tour.min.js

<script type="text/javascript" src='bootstrap-tour.min.js'></script>
<link rel="stylesheet" type="text/css" href="bootstrap-tour.min.css">

这是我的视图页

<form>
    <input id="one" value="one" />
    <input id="two" value="two" />
</form>

这是我的js文件

// Instance the tour
$(function () {
    var tour = new Tour();
    tour.addStep({
        element: "#one",
        title: "Step 1",
        content: "Content for step 1"
    });
    tour.addStep({
        element: "#two",
        title: "Step 1",
        content: "Content for step 1"
    });
    // Initialize the tour
    tour.init();
    // Start the tour
    tour.start();
});
// tour end

但仍然不工作…

我要问你一些问题,希望他们已经帮到你了。

你得到了什么错误信息(如果有的话)?我认为bootstrap-tour依赖于bootstrap,你设置了吗?你是否使用了application.js/application.css?或者application.css.scss(如果您使用了bootstrap-sass gem) ?

你是在使用gem 'boostrap-tour-rails',还是在使用纯css?