2

我们希望有一个通用的多页面导览,以及适用于 Web 应用程序的页面特定导览。多页面正在运行,特定页面的页面也触发,但调用这两个旅游数据对象。有没有办法在同一页面上进行多个游览?

function initTours(){

// Start intro tour
document.getElementById('startIntro').onclick = function() {
    introJs().setOption('doneLabel', 'Next page').start('.intro-farm').oncomplete(function() {
        window.location.href = 'nav_season.php?multipage=true';
    });
};

var tourStep = $('.content .intro-farm').attr('data-step');
var nextLink = $('#nextTourLink').attr('href');
if (RegExp('multipage', 'gi').test(window.location.search)) {
    introJs().setOption('doneLabel', 'Next page').goToStep(tourStep).start('.intro-farm').oncomplete(function() {
        window.location.href = nextLink+'?multipage=true';
    });
} 

//Page specific
if ($('.page-tour').length > 0){
    //Page specific tour
    $('.pageHelp').on('click',function() {
        introJs().start('.page-tour');
    });
} else {
    $('.pageHelp').on('click',function(){
        $('#messageModal .row').html("<p>We don't have help tips for this page, but if you are stuck, please don't hesitate to <a href='#'>contact us</a>.</p>")
        $('#messageModal').foundation('reveal', 'open');
    });
}
}
4

3 回答 3

0

您可能希望使用Programmatic 方式定义您的步骤,因此您可以根据需要定义您的步骤。如果我对您的理解正确,您的旅行都包含所有步骤,对吗?

于 2013-08-11T08:39:59.400 回答
0

当然,您可以在同一页面中有多个游览,但是您应该检查页面的 url 并制定条件并防止再次调用第一个游览。

例如假设您的页面是boo.php,那么对于第一个游览,您应该检查是否window.location.pathname等于boo.php,然后向用户显示第一个游览并在重定向到下一页(例如boo.php?anotherPage=true)后再次检查页面的 url 并显示下次巡演给他。

于 2013-08-11T08:23:18.840 回答
0

看下面的代码。它工作正常。

if (RegExp('multipage', 'gi').test(window.location.search)) {
    introJs().setOption('doneLabel',
         'Your next Page &rarr; (Name of Page)').start().oncomplete(function() {
        window.location.href = 'nextpage.html?multipage=true';
    });
}
于 2016-08-26T20:31:33.930 回答