Coder Social home page Coder Social logo

tour's Introduction

Tour

Hire Space Logo

Bootstrap plugin to add a tour to a webpage. See working demo at http://hirespacedemos.azurewebsites.net/Tour

Html markup

A tour element on the page is just a parent div with class="tour" and buttons or links to stop and start the tour. Use the 'data-stop' and 'data-start' attributes to specify which elements should stop and start the tour. You can style the tour however you want, but the bootstrap panel class works nicely, e.g

<div class="panel panel-danger tour" id="my-tour">
<div class="panel-heading">
First time here? Take a tour of the website's features.
 </div>
 <div class="panel-body">
<button class="btn btn-danger" data-start="tour">Start</button>
<button class="btn btn-danger" data-stop="tour">Stop</button>
</div>
</div>

Javascript

To implement the tour, you need to call the function on the element you want to attach a tour to. So for the above mark-up, you could call it as follows: $('#my-tour').tour(options);

The 'options' parameter is a complex object with the following properties:

  • 'manual' : sets whether the tour needs to be clicked through or whether, on start, it runs automatically. This defaults to true.
  • 'delay': if manual is set to false, this determines the length of time between showing each item on the tour, in milliseconds. This defaults to 2000.
  • 'items' : this is an array of objects representing the tour items. Each item should have an 'id' property, which is the id of the div on the page, and a 'description' which is the text you want displayed for that div. They can also have an optional 'placement' property, dictating where the popover should appear. This defaults to 'right'. So an example implementation might look like:
 var options = {
     items: [{
        id: '#tour-0',
        description: 'This div does something',
        placement: 'left'
       },
       {
         id: '#tour-1',
         description: 'This div does something else'
       }],
     manual: false,
     delay: 1000
  };
 
  $('#my-tour').tour(options);

Copyright and license

Code and documentation copyright 2014 Hire Space. Code released under the MIT license.

tour's People

Contributors

deanhume avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.