|
1 | 1 | /* ========================================================================
|
2 | 2 | *
|
3 |
| - * Bootstrap Tourist v0.3.0 |
| 3 | + * Bootstrap Tourist v0.3.2 |
4 | 4 | * Copyright FFS 2019
|
5 | 5 | * @ IGreatlyDislikeJavascript on Github
|
6 | 6 | *
|
|
11 | 11 | *
|
12 | 12 | * The entire purpose of this fork is to start rewriting bootstrap-tour
|
13 | 13 | * into native ES6 instead of the original coffeescript, and to implement
|
14 |
| - * the features and fixes requested in the github repo. Ideally this fork |
15 |
| - * will then be taken back into the main repo and become part of |
16 |
| - * bootstrap-tour again - this is not a fork to create a new plugin! |
| 14 | + * the features and fixes requested. |
17 | 15 | *
|
18 | 16 | * I'm not a JS coder, so suggest you test very carefully and read the
|
19 |
| - * docs (comments) below before using. |
20 |
| - * |
21 |
| - * If anyone would like to take on the creation of proper docs for |
22 |
| - * Tourist, please feel free and post here: |
23 |
| - * https://github.com/IGreatlyDislikeJavascript/bootstrap-tourist/issues/15 |
| 17 | + * docs before using. |
24 | 18 | *
|
25 | 19 | * ========================================================================
|
26 | 20 | * ENTIRELY BASED UPON:
|
|
56 | 50 | })(window, function ($) {
|
57 | 51 |
|
58 | 52 | const DOMID_BACKDROP = "#tourBackdrop";
|
| 53 | + const DOMID_BACKDROP_TEMP = "#tourBackdrop-temp"; // used for @ibastevan zindex fix: https://github.com/IGreatlyDislikeJavascript/bootstrap-tourist/issues/38 |
59 | 54 | const DOMID_HIGHLIGHT = "#tourHighlight";
|
| 55 | + const DOMID_HIGHLIGHT_TEMP = "#tourHighlight-temp"; // used for @ibastevan zindex fix: https://github.com/IGreatlyDislikeJavascript/bootstrap-tourist/issues/38 |
60 | 56 | const DOMID_PREVENT = "#tourPrevent";
|
61 | 57 |
|
62 | 58 | var Tour, document, objTemplates, objTemplatesButtonTexts;
|
|
114 | 110 | backdropOptions: {
|
115 | 111 | highlightOpacity: 0.9,
|
116 | 112 | highlightColor: "#FFF",
|
| 113 | + backdropSibling: false, |
117 | 114 | animation: {
|
118 | 115 | // can be string of css class or function signature: function(domElement, step) {}
|
119 | 116 | backdropShow: function(domElement, step)
|
|
329 | 326 | host: '',
|
330 | 327 | placement: 'right',
|
331 | 328 | positioning:{
|
332 |
| - adjustRelative: null |
| 329 | + adjustRelative: null // this does nothing at the moment |
333 | 330 | },
|
334 | 331 | title: '',
|
335 | 332 | content: '<p></p>',
|
|
436 | 433 |
|
437 | 434 | // BS3: resize event must destroy and recreate both popper and background to ensure correct positioning
|
438 | 435 | // BS4: resize must destroy and recreate background, but popper.js handles popper positioning.
|
439 |
| - // TODO: currently we destroy and recreate for both BS3 and BS4. Improvement could be to reposition backdrop overlay only when using BS4 |
440 | 436 | var _this = this;
|
441 | 437 | $(window).on("resize.tour-" + _this._options.name, function()
|
442 | 438 | {
|
|
1848 | 1844 | {
|
1849 | 1845 | $(DOMID_BACKDROP).hide(0);
|
1850 | 1846 | $(DOMID_HIGHLIGHT).hide(0);
|
| 1847 | + $(DOMID_BACKDROP_TEMP).remove(); |
| 1848 | + $(DOMID_HIGHLIGHT_TEMP).remove(); |
1851 | 1849 | }
|
1852 | 1850 | };
|
1853 | 1851 |
|
|
2136 | 2134 | }
|
2137 | 2135 | }
|
2138 | 2136 | }
|
| 2137 | + |
| 2138 | + // purpose of this code is due to elements with position: fixed and z-index: https://github.com/IGreatlyDislikeJavascript/bootstrap-tourist/issues/38 |
| 2139 | + $(DOMID_BACKDROP_TEMP).remove(); |
| 2140 | + $(DOMID_HIGHLIGHT_TEMP).remove(); |
| 2141 | + if (step.backdropOptions.backdropSibling == true) |
| 2142 | + { |
| 2143 | + $(DOMID_HIGHLIGHT).addClass('tour-behind'); |
| 2144 | + $(DOMID_BACKDROP).addClass('tour-zindexFix'); |
| 2145 | + $(DOMID_HIGHLIGHT).clone().prop('id', DOMID_HIGHLIGHT_TEMP.substring(1)).removeClass('tour-behind').insertAfter(".tour-highlight-element"); |
| 2146 | + $(DOMID_BACKDROP).clone().prop('id', DOMID_BACKDROP_TEMP.substring(1)).removeClass('tour-zindexFix').insertAfter(".tour-highlight-element"); |
| 2147 | + } |
| 2148 | + else |
| 2149 | + { |
| 2150 | + $(DOMID_HIGHLIGHT).removeClass('tour-behind'); |
| 2151 | + $(DOMID_BACKDROP).removeClass('tour-zindexFix'); |
| 2152 | + } |
2139 | 2153 | };
|
2140 | 2154 |
|
2141 | 2155 | // Updates visibility of the preventInteraction div and any other overlay elements added in future features
|
|
0 commit comments