首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在d3.js元素上使用intro.js

如何在d3.js元素上使用intro.js
EN

Stack Overflow用户
提问于 2015-08-17 23:42:14
回答 1查看 310关注 0票数 1

我使用d3.js生成一个sankey图,并使用intro.js对页面进行向导浏览。除了d3图形之外,Intro.js可以在我的所有页面上运行。例如,我还使用intro.js浏览了同样由js库DataTables动态生成的其他元素,它工作得很好。

我的DataTables教程代码如下:

代码语言:javascript
复制
document.getElementById('help').onclick = function (){
  var intro = introJs();
    intro.setOptions({
      steps: [
        { 
          intro: "These are the results of your search."
        },
        {
          element: "[name=DataTables_Table_0_length]",
          intro: "Select how many results to view.",
          position: "right"
        },
        {
          element: "[type=search][aria-controls=DataTables_Table_0]",
          intro: 'Here you can search the table.',
          position: 'left'
        },
        {
          element: "[class=ColVis]",
          intro: "To show or hide columns, use this.",
          position: "left"
        },
        {
          element: "[class=DTTT_container]",
          intro: "Use these buttons to download, print or copy the data in the     table.",
          position: "left"
        },
        {
          intro: "Select an NPI to view its homepage and we'll continue from there."
        }
      ],
      'showBullets': true,
      'skipLabel': 'Let me drive',
      'doneLabel': "Try it out"
    });

intro.start();
};

所有这些元素都是动态生成的,但在被调用时会被intro.js识别。

但是,当我尝试对d3元素执行相同的操作时,intro.js找不到它们。

代码语言:javascript
复制
document.getElementById('help').onclick = function (){
  var intro = introJs();
    intro.setOptions({
      steps: [
        { 
          intro: "These are the results of your search."
        },
        {
          element: "[class=legend-items]",
          intro: "This is the legend.",
          position: "right"
        }
      ],
      'showBullets': true,
      'skipLabel': 'Let me drive',
      'doneLabel': "Try it out"
    });

    intro.start();
};

这是我的d3图表的截图:

有没有人遇到过这个问题,可以给我一些启发?

非常感谢。

EN

回答 1

Stack Overflow用户

发布于 2016-07-07 22:01:30

这在intro.js存储库上仍然是一个悬而未决的问题:https://github.com/usablica/intro.js/issues/66

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32054433

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档