Join the Webstudio community

Updated 2 years ago

Defining Classes at This Stage

At a glance

The community members discuss the ability to define classes in a similar way to defining IDs. One community member confirms that classes can be added as custom properties in the properties panel. Another community member asks why the class is needed, and the original poster explains that some tools, like CRM or CRO tools, can be launched via a button with a specific class, using Drift's live chat as an example.

The discussion continues with community members exploring the use of IDs versus classes, and whether tools typically use IDs or classes. One community member provides an example of how Drift's live chat can be triggered using a class, but another community member notes that an ID could also be used for the same purpose.

There is no explicitly marked answer in the comments, but the community members provide helpful information and examples around the use of classes and IDs in web development.

Useful resources
Is there anywhere to define classes at this stage? Similar to how we can define an ID.
O
A
10 comments
Yess, class name is just a property, you can add it over the custom properties in properties panel.
Question: why did you want to use a class?
I am still considering bringing it to the same section where the id is, even though both are just properties.

Just in case people really need it often.
Got it! Thank you πŸ™‚

Some tools (like CRM's or CRO tools) can be launched via a button with a specific class.

Drift's live chat is a good example of this
Basically creating an element with a class and then using hmtl embed with a script to access that element via class
those tools don't use ids?
I would have assumed they would use id most of the time
do you have some examples how they tell. users to use it?
Most use ID's or #[PARAM] links.

As I've been building out a page today for the video I've also been creating a list of features I'd like to have, nice to have, suggestions and bugs which is where these questions are coming from.

Here's an example of a a tool needing a class trigger: https://devdocs.drift.com/docs/start-a-chat-with-a-link
Plain Text
drift.on('ready', function(api) {
    document.querySelector('.drift-open-chat')
        .addEventListener("click", function(){
          drift.api.startInteraction({ interactionId: xxxxxxx }); /* <-- your playbook's interaction ID here */
        })
      })


This ?

IT doesn't need a class, you can use an id, its just a example:

document.querySelector('#drift-open-chat') would do the same
Add a reply
Sign up and join the conversation on Discord