gpt4 book ai didi

javascript - 跳房子 on 关闭游览功能

转载 作者:行者123 更新时间:2023-11-28 06:07:27 24 4
gpt4 key购买 nike

我正在使用 Hopscotch 创建游览,我希望为用户创建在点击页面后进行或退出页面游览的功能。

我正在尝试创建一个 onClose 函数,但我遇到了困难。

var tour = {
id: "businesstour-hopscotch",
steps: [
{
title: "Welcome",
content: "This is the new business profile page, click next to have a quick tour.",
target: document.querySelector('#companyname'),
placement: "right",
xOffset: -380,
yOffset: 52,
onClose: function() {
window.location = '/';
}
},

等等,但它不起作用。也没有显示结束游览的按钮。任何想法都会有帮助!

最佳答案

根据我对文档的理解,onClose 定义是一个“Tour Option”,应该像这样声明,而不是在步骤内声明:

var tour = {
id: "businesstour-hopscotch",
onClose: function() {
window.location = '/';
},
steps: [{
title: "Welcome",
content: "This is the new business profile page, click next to have a quick tour.",
target: document.querySelector('#companyname'),
placement: "right",
xOffset: -380,
yOffset: 52
}]
};

我正在像这样初始化我的,这适用于用户单击游览右上角的“x”。但是,当用户单击导览最后一步的“完成”按钮时,我没有看到此事件被触发。

关于javascript - 跳房子 on 关闭游览功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36705875/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com