diff --git a/.gitignore b/.gitignore index e1b67ac..9acea27 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ npm-debug.log .idea .vscode package-lock.json -yarn-error.log \ No newline at end of file +yarn-error.log +dist/demo diff --git a/demo/scripts/demo.js b/demo/scripts/demo.js index 4041f5b..0ff92f6 100644 --- a/demo/scripts/demo.js +++ b/demo/scripts/demo.js @@ -145,7 +145,7 @@ document.addEventListener("DOMContentLoaded", function () { ///////////////////////////////////////////// // Form focus examples ///////////////////////////////////////////// - const focusDriver = new Driver({ padding: 0 }); + const focusDriver = new Driver({padding: 0}); const inputIds = ['creation-input', 'creation-input-2', 'creation-input-3', 'creation-input-4']; inputIds.forEach(inputId => { // Highlight the section on focus @@ -293,6 +293,34 @@ document.addEventListener("DOMContentLoaded", function () { }); }); +///////////////////////////////////////////// +// Single no close demo +///////////////////////////////////////////// + const singleNoClose = new Driver({ + allowClose: false, + position: 'top' + }); + + singleNoClose.defineSteps([{ + element: '#single-element-no-close', + popover: { + title: 'Uh-huh!', + description: 'You cannot close by clicking outside' + } + }, { + element: '#third-element-introduction', + popover: { + title: 'Title on Popover', + description: 'Body of the popover', + position: 'top' + } + }]); + + document.querySelector('#run-single-element-no-close').addEventListener('click', function (e) { + e.preventDefault(); + singleNoClose.start(); + }); + ///////////////////////////////////////////////////// // Highlighting single element with popover position ///////////////////////////////////////////////////// diff --git a/index.html b/index.html index 31306e6..f4b6a14 100644 --- a/index.html +++ b/index.html @@ -6,9 +6,9 @@ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
And of course it can be any valid HTML.
By default, driver.js gets reset if user clicks outside the highlighted element, you can disable this:
+ Show Demo +const driver = new Driver({
+ allowClose: false,
+});
+driver.highlight({
+ element: '#some-element',
+ popover: {
+ title: '<em>An italicized title</em>',
+ description: 'Description may also contain <strong>HTML</strong>'
+ }
+});
+
+ + If you use this option, for multi-step driver, it would close after you are done with the popover or you can close it programmatically. For single element popover, you need to close it properly, otherwise it won't be closed +
+driver.reset()You can also make powerful feature introductions to guide the users @@ -343,8 +364,15 @@ activeElement.getNode(); // Gets the DOM Element behind this element - - - + + +