2017-01-02 44 views
0

我在我的网站中使用bootstrap并解释我的网站我想使用bootstrap tour。我已经在我的测试页中实现了这一点,并且工作正常。但是在加载页面时浏览开始,并且我想在点击按钮时开始浏览。我按照此article来实施我的引导游览。自助旅游启动按钮

这是自举游试玩的一个javascript:

(function(){ 

    var tour = new Tour({ 
     storage : false 
    }); 

    tour.addSteps([ 
     { 
     element: ".tour-step.tour-step-one", 
     placement: "bottom", 
     title: "Welcome to our landing page!", 
     content: "This tour will guide you through some of the features we'd like to point out." 
     }, 
     { 
     element: ".tour-step.tour-step-two", 
     placement: "bottom", 
     title: "Main navigation", 
     content: "Here are the sections of this page, easily laid out." 
     }, 
     { 
     element: ".tour-step.tour-step-three", 
     placement: "top", 
     backdrop: true, 
     title: "Main section", 
     content: "This is a section that you can read. It has valuable information." 
     }, 

    ]); 

    // Initialize the tour 
    tour.init(); 

    // Start the tour 
    tour.start(); 

}()); 

,这是HTML部分:

<div class="content-section-a tour-step tour-step-one"> One <br> 

<div class="content-section-a tour-step tour-step-two"> Two <br> 

<div class="content-section-a tour-step tour-step-three"> Three <br> 

如何开始我游通过点击一个按钮?

感谢

回答

0

当您单击该按钮,而不是在页面加载只需拨打tour.start();。假设你的startbutton的编号为start-tour。这个片段可以放置在(function() { ... })

$("#start-tour").click(function() { 
    tour.start(); 
}); 
+0

我有我的页面添加此: ,这个按钮:启动 但不起作用 – Frankie

+0

如何关闭脚本在加载网页的时间? – Frankie

+0

除了你已经做了什么,你将不得不包括jQuery和删除tour.init();从你的代码。 –