usablica / intro.js

Lightweight, user-friendly onboarding tour library
http://introjs.com
Other
22.76k stars 2.59k forks source link

Selecting an element through a html tag such as `data-element="#card__body" #1936

Closed AshtonHylton-awin closed 1 year ago

AshtonHylton-awin commented 1 year ago

This is less of an issue and potentially more of a feature request, which if is not an option i'd be happy to look into creating a pull request if put in the right direction :)

I would like to know how to potentially focus on an element whilst defining an elements selector from within the HTML like how its done with the JS version element: document.querySelector('.card-demo')

The closest example to being able to configure a step through HTML is in this example from the website https://introjs.com/docs/examples/basic/hello-world.

In that example data-title="Farewell!" data-intro="And this is the last step!" the data attributes are added to the html element that is being selected. However I would like to be able to define this separately and select the element after.

Using the same example from the website I would like to be able to define the step html separately potentially with a data- attribute that can define the class/ID that is to be selected.

E.g. <div data-attribute=".card__image" data-title="Farewell!" data-intro="And this is the last step!" or a another way if possible.

sovetski commented 1 year ago

Is there any reason to don't use this https://introjs.com/docs/examples/basic/json-config ?

binrysearch commented 1 year ago

Agreed with @sovetski