首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Intro.js更改工具提示位置

Intro.js更改工具提示位置
EN

Stack Overflow用户
提问于 2014-11-07 07:25:32
回答 1查看 5.1K关注 0票数 2

我在我的网站上使用intro.js进行浏览。我使用bottom作为默认的工具提示位置,但是有什么方法可以在浏览开始后更改工具提示的位置吗?

下面是我的代码:

代码语言:javascript
复制
tourPluginObject=introJs();
    tourPluginObject.onchange(function(targetElement) {
      if($(targetElement).attr("data-step")==5 && enteredStepFive==false){
        enteredStepFive=true;//I entered a step five, so mark this
        tourPluginObject.setOption('tooltipPosition','left');//Set new tooltip position
        tourPluginObject.setOption('data-position','left');//Set new tooltip position
        tourPluginObject.refresh();//Refresh layout
      }
    });
    tourPluginObject.setOptions({'tooltipPosition': 'bottom' });//Set default tooltip position
    tourPluginObject.start();//Start tour
EN

回答 1

Stack Overflow用户

发布于 2014-12-04 01:17:29

如果您可以修改html,则可以在元素5上添加数据属性data-position="left",并保留其他元素的位置,或者将它们全部设置为"bottom“。

这样,step5将具有所需的位置,而无需在运行时对其进行修改。

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

https://stackoverflow.com/questions/26791340

复制
相关文章

相似问题

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