Hello WeWeb Community,
I am aiming to create a guided onboarding experience on my WeWeb project. My goal is to provide users with an interactive tour that highlights various elements on the page.
I tried using the NPM plugin in WeWeb to install driver.js
and wrote the following code:
const driverObj = driver({
showProgress: true,
showButtons: ['next', 'previous'],
steps: [
{ element: '#tour-example', popover: { title: 'Animated Tour Example', description: 'Here is the code example showing animated tour. Let's walk you through it.', side: "left", align: 'start' }},
{ element: 'code .line:nth-child(1)', popover: { title: 'Import the Library', description: 'It works the same in vanilla JavaScript as well as frameworks.', side: "bottom", align: 'start' }},
{ element: 'code .line:nth-child(2)', popover: { title: 'Importing CSS', description: 'Import the CSS which gives you the default styling for popover and overlay.', side: "bottom", align: 'start' }},
{ element: 'code .line:nth-child(4) span:nth-child(7)', popover: { title: 'Create Driver', description: 'Simply call the driver function to create a driver.js instance', side: "left", align: 'start' }},
{ element: 'code .line:nth-child(16)', popover: { title: 'Start Tour', description: 'Call the drive method to start the tour and your tour will be started.', side: "top", align: 'start' }},
]
});
driverObj.drive();
Unfortunately, I’m encountering the following error:
ReferenceError: driver is not defined
I have tried both import
and require
statements, but I keep facing issues like “Cannot use import statement outside a module” or initialization errors.
Could someone guide me on how to properly set up and use driver.js
within WeWeb using the NPM plugin? Alternatively, is there another way to achieve a similar guided onboarding experience?
Any help would be greatly appreciated!
Thank you!