0

I made a tour through my website. I want that users can start the tour manually on button click after they end the tour.

Button:

<a href="#" id="tour"><i class=""></i> Start Tour</a>

Bootstrap tour script.

<script type="text/javascript">
var tour = new Tour();
tour.addSteps([
{
    element: "#step1",
    title: "Welcome.", 
    content: "Welcome to step one.", 
    placement: "top"
}
]);
tour.addSteps([
{
    element: "#step2", 
    title: "Contact us.", 
    content: "If you have any questions, please contact us.",
    placement: "left"
}

]);
tour.start();
</script>
Joshua Dwire
  • 5,415
  • 5
  • 29
  • 50
strellson
  • 125
  • 1
  • 2
  • 12

1 Answers1

3

This should be as simple as adding a click event to the button in your JavaScript.

For example:

$('#tour').click(function(e){
    tour.start();

    // it's also good practice to preventDefault on the click event
    // to avoid the click triggering whatever is within href:
    e.preventDefault(); 
});
johnkavanagh
  • 4,614
  • 2
  • 25
  • 37