gpt4 book ai didi

php - 触发由父 View 引起的任何事件时退出 Tour - Intro.js

转载 作者:行者123 更新时间:2023-12-01 06:32:45 25 4
gpt4 key购买 nike

File Manager - Home Normal File Manager - Home Normal我使用的大部分内容都基于 AJAX 回调。单击页面上的链接按钮会弹出一个模式(btn 有一些类,并且触发 jquery 事件来加载该模式弹出窗口并显示内容)。我的应用程序中使用的导游是 Intro.js,我从 http://www.introjs.com 下载它。基于社区的一些建议。

只要执行正常的例程,IntroJs 就可以正常工作。

这是我的代码(仅包含相关行):

elementsArrays = getIntroElements();    //  Get All the elements that can be in tour list

availableElements = getAvailableElements(elementsArrays) // Input the Array of Elements and Return Available Elements in page
TotalCount = availableElements.ids.length + availableElements.classes.length + 2; // Set the Object for ease-of-access

setUpIntroElements(); // SetsUp the route path for tourguide to move through

introJs().start(); // Starts the Tour Guide

但是当我单击链接按钮时(当导游正在进行时,该按钮此时可以访问(例如,目标突出显示的元素是主容器,更新按钮是突出显示区域的一部分。因此它是可单击的。 )),弹出相应的模态窗口,但游览尚未完成。我按左/右箭头键,introjs 的下一个数据步骤出现在我的模式弹出窗口上。 (Modal popup window) Modal popup window

这是我尝试关闭游览的代码

//  Close the wizard on any button click or disabled clicking any button there in the page
$("body").on("click", ".filemgt-file-index a", function(e){
if( $(".introjs-showElement")[0] ) // case: the tour is in process
{
//e.stopPropagation(); // not working
e.stopImmediatePropagation() // not working

//var esc = $.event("keydown", {keyCode:27});
//$("body").trigger(esc); // didnt work at all

// Trigger the below event
// a.introjs-button.introjs-skipbutton
introJs().exit(); // Exit the Tour and Work on new set // doesn't work very well
// need to apply "press Esc event" programmatically in jquery
// Triggering event equavalent to pressing Esc button
// disable all events associated with it
introJs().exitIntro()
}
});

当我关闭/取消模态窗口时,游览仍然没有终止,并且按左/右箭头键显示相应的数据步骤元素介绍。 (File Manager - Home (after Closing Modal popup)) File Manager - Home (after Closing Modal popup)

我想要实现的是,如果点击导游中的任何链接,游览应该结束,并且新的模式应该弹出,所有焦点都集中在它上面。

所附图片说明了情况以及我到底想要什么。看一下它们,如果我在问题陈述中遗漏了某些内容,请告诉我。

提前非常感谢您。保持祝福。

最佳答案

这不是标准解决方案,但它帮助我随时随地解决问题。

在查看浏览器窗口中出现的源代码时(检查元素(F12 功能键),我发现了一个针对工具提示弹出的跳过按钮的“introjs-skipbutton”类。

我发现单击此按钮会退出游览,因此我将以下代码放入我的 JQUERY 文件中:

//  Close the wizard on any button click or disabled clicking any button there in the page
$("body").on("click", ".main_container_div_of_view a", function(e){
if( $(".introjs-showElement")[0] ) // case: the tour is in process
{
$('.introjs-skipbutton').click(); // Terminate Introduction
}
});

这样就成功了并退出了游览。但在我看来,这仍然不是标准做法。

关于php - 触发由父 View 引起的任何事件时退出 Tour - Intro.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42667242/

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