Comments (1)
Thanks for your contribution. This is a really good idea and something I think will be widely used where more than 1 tour is available.
Right now I have a similar challenge - site "pages" where there is more than one potential tour, which I solve with a horrible hacky solution.
I had some initial thoughts:
You've added "title" and "description" to the tour options, I think these make sense to incorporate into Tourist anyway, even without the tour manager.
I think we should consider making a dynamic tour manager. In your example you create your tour in the js, and then call addTour() for each tour. How about we turn this into a manager with a lazy load?
- The relevant tours are stored in one or more separate .js.
- TouristManager is instantiated, and an object is passed to TouristManager that identifies all the relevant tours on the page and their details. Note that these are not the individual tour options, they simply identify the tours (and objects that have those tour options).
var allMyTours = {
{
name: "WelcomeTour", // identifies the tour in the js from source: option?
source: "js/my_page_tours.js", // what file is this tour in?
description: ....,
...other options?...
},
{
name: "ExpertTour", // identifies the tour in the js from source: option?
source: "js/my_page_tours.js", // Could be the same or different files per tour
......
}
};
var manager = new TouristManager({
managedTours: allMyTours,
lazyload: true,
...options?...
});
Then, in js/my_page_tours.js, you would have your normal tour options:
var WelcomeTour = {
name:"WelcomeTour",
title:"First steps",
description:"You will learn the first steps with FP Sign",
debug:true,
framework: "bootstrap4", // or "bootstrap4" depending on your version of bootstrap
};
- Tours are then run by calling the Manager and asking for them:
var activeTour = manager.loadTour(...some tour name in allMyTours...);
- If lazyload is true, Manager loads the tour on demand:
function loadTour(tourName)
{
var tourFile = ...find the source .js from the object, by tour name...
$.getScript(tourFile);
return new Tour(tourName);
}
This would avoid the scenario where a page that has multiple tours (or even one massive single tour) loads them all into the DOM on page load.
Then we include your tour manager ability to let users select their own tour etc, with templating etc.
What do you think?
I already see one issue to solve, which is the need to duplicate "title" and "description" properties in the options passed to the manager, and the individual tour options.
Also, maybe we can incorporate the manager into Tourist itself, to avoid 2 plugins. This changes the paradigm slightly, because a Tourist instance now doesn't represent one tour but a possibility of multiple tours...
Interesting discussion!
from bootstrap-tourist.
Related Issues (20)
- Tour initialization flashes / visible backdrop
- Backdrop covers only the viewport and can be scrolled away HOT 12
- Offset calculation of highlighted element is wrong sometimes HOT 3
- reflexOnly: true allow proceed if using keyboard arrows HOT 3
- Element not clickable when its ancestor has a position fixed and z-index lower than the tour-backdrop which is sibling HOT 2
- [Feature request] Add highlight padding option HOT 2
- [Feature request] Ability to highlight multiple elements at once HOT 1
- incorrect isOrphan Step detection under certain conditions HOT 6
- Misplaced tour if target element has overflow:auto CSS HOT 2
- Angular HOT 4
- On the last step in the tour the next button is disabled, but can still be clicked HOT 5
- backdropPadding HOT 1
- FYI: FIXING ISSUES DURING PANDEMIC HOT 3
- Issue with pause-resume buttons HOT 1
- Next button partially working at the end of the tour. HOT 2
- Bootstrap 4.5 compatibility? HOT 1
- $(...).stop is not a function? HOT 1
- Cannot highlight elements with the style display: contents and incorrect highlight position with fixed elements HOT 1
- IGreatlyDislikeJavascript
- Bootstrap 5 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootstrap-tourist.