【问题标题】:How do I select just the first element of a specific class in Bootstrap Tour?如何在 Bootstrap Tour 中仅选择特定类的第一个元素?
【发布时间】:2016-12-05 00:12:11
【问题描述】:

在执行我的 Tour 的页面上,我有许多带有 .contact-box 类的 div。

我不想全选,只选择第一个。

我试过了:

  {
    element: "#page-wrapper div.contact-box:first-of-type",
    title: "Player Info",
    content: "Here we have a quick snapshot of "
  },

但这没有用。

我想做什么?

【问题讨论】:

  • 发布你的整个 JS 代码。

标签: jquery ruby-on-rails twitter-bootstrap bootstrap-tour


【解决方案1】:

事实证明,我所要做的只是在我的视图中使用我的实例变量。

我在 profiles#index.html.erb<script type=text/javascript> 标记中实现了这个,所以这就是我所做的:

  {
    element: '#page-wrapper div.contact-box.profile-<%= @profiles.first.id %>',
    title: "Player Info",
    content: "Blah blah blah"
  },

这只是选择了我想要的contact-box div 之一。

【讨论】:

    猜你喜欢
    • 2011-07-14
    • 1970-01-01
    • 2015-06-07
    • 1970-01-01
    • 2011-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多