触发由父视图引起的任何事件时退出巡视-Intro.js

ahm*_*utt 1 php jquery intro.js yii2

文件管理器 - 家庭普通 文件管理器 - 家庭普通 我根据AJAX回调使用大部分内容。单击我页面上的链接按钮会弹出一个模态(btn具有一些类,并且会触发jquery事件以加载该模态弹出并显示内容)。根据社区的一些建议,我从http://www.introjs.com下载了我的应用程序中使用的Tour Guide 。

只要执行常规例程,IntroJ即可正常工作。

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

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
Run Code Online (Sandbox Code Playgroud)

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

这里是我试图关闭旅游按下码

//  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()
    }
});
Run Code Online (Sandbox Code Playgroud)

当我关闭/取消模式窗口时,巡视仍未终止,按向左/向右箭头键会显示相应的数据步骤元素简介。(文件管理器-主页(在关闭模态弹出窗口之后)文件管理器-主页(在关闭模态弹出窗口之后)

我要实现的是,如果单击导览中的任何链接,则导览应结束,并且新的模式应弹出并全部集中在该模式上。

所附图像说明了这种情况以及我到底想要什么。看看他们,然后让我知道问题陈述中是否缺少某些内容。

非常感谢你提前。祝好运。

ahm*_*utt 5

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

在查看源代码出现在浏览器窗口(检查Element(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
    }
});
Run Code Online (Sandbox Code Playgroud)

这样就可以了,然后退出游览。但我认为这仍然不是标准做法。