1
if (!sessionStorage.getItem('introSkipped')) {
        introJs()
            .setOptions({
                steps: [
                    {
                        element: document.querySelector('#test'),
                        intro: "lorem ipsum."
                    },
                ],
                showStepNumbers: true,
                exitOnOverlayClick: false,
                hidePrev: true,
            })
            .onexit(function() {
                sessionStorage.setItem('introSkipped', 'true');
            })
            .start();
    }

The intro.js element can use an ID or class to call the intro.js. So, if I want to use intro JS, that means I have to put that code on every page I want to provide intro JS

I have 2 questions

  1. So what if I want intro.js to be global, what this means is that I don't need to put that code on every page I want to implement intro.js on. I want to create a page to add or edit intro.js and later the edited page will change to intro.js?

  2. and I don't want to use the ID or class element to call intro.js, because my output here is that not only the developer team can add or edit intro js, ​​but teams other than developers can also add or edit it without knowing the ID, so is there a way besides using element id or class to call intro.js?

i use codeigniter

1
  • 1. Global Intro.js: Include the intro.js code in a global layout file (e.g., main.php), so it applies across all pages without needing to repeat the code. 2. No ID/Class for Intro.js: Store intro steps in a database (e.g., selector, description), then dynamically generate and apply these steps using JavaScript, allowing non-developers to edit them. Commented Dec 27, 2024 at 16:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.