javascript - Multiple tours with intro.js -
we'd have 1 general multi-page tour , page specific tours available web app. multipage 1 functioning, , page specific 1 triggers, calls both tour data objects. there way have multiple tours on same page?
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 tips page, if stuck, please don't hesitate <a href='#'>contact us</a>.</p>") $('#messagemodal').foundation('reveal', 'open'); }); } }
sure can have multiple tours in same page should check url of page , make condition , preventing calling first tour again.
for example suppose page boo.php
, first tour should check whether window.location.pathname
equals boo.php
or not, , show first tour user , after redirecting next page (e.g. boo.php?anotherpage=true
) check url of page again , show next tour him.
Comments
Post a Comment