javascript - 使用 Intro.js 时如何针对特定步骤调整工具提示的样式

标签 javascript jquery intro.js

我正在尝试更改第一步 (data-step="1") 的样式,我通过调用 onbeforechange()

introJs().onbeforechange(function(targetElement) {
    switch (targetElement.getAttribute("data-step"))
    {
        case "1":
            //change CSS styling only for the first box
            $(".introjs-helperLayer .introjs-tooltip").attr("style", "margin-left: 10%");

        break;
    }
}).start();

基本上,我试图在第一步中将工具提示居中。任何帮助深表感谢;我是 JavaScript 的新手。

最佳答案

尝试使用这段代码:

introJs().onbeforechange(function(targetElement) {
    switch (targetElement.getAttribute("data-step"))
    {
        case "1":
            //change CSS styling only for the first box
            $(".introjs-helperLayer").css("text-align", "center");

        break;
    }
}).start();

关于javascript - 使用 Intro.js 时如何针对特定步骤调整工具提示的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17414054/

相关文章:

javascript - AddEventListener 用于循环闭合

javascript - 在 cypress.io 中对动态文件运行测试

javascript - intro.js - 添加 Shift + ?键盘热键/快捷键支持启动(或触发)introJs().start()

javascript - Kendo UI 窗口动态打开

javascript - 函数 getElementsByTagName 没有返回具有可拖动列表项的 ul 的正确顺序

Javascript 无法在编号 'guid' 上创建属性 '100'

jquery - 获取插入符位置上的当前单词

javascript - jquery总计时间不正确

javascript - IntroJs如何实现高亮区域?

javascript - 将产品游览库与 VueJS 结合使用