Add class not working

It shows up in the DOM on a click event, but it doesn’t actually apply the CSS styles.

Hi! :slight_smile: I don’t think that’s problem with “addClass”. If the class is showing in the DOM, then the event actions is working. The question here is: which css code do you expect here to apply? Are you sure that it’s really loaded? CSS code does not load just for the reason that a CSS class gets added. When using CSS styles from the Builder, they are dynamically loaded only where they are needed. So you need to define your css style, which you need everywhere, somewhere else, for example with WPCodeBox or just on the Bricksforge Global Classes area.

I hope this helps :slight_smile:

Ok thanks I got something to work, but I don’t think this is ideal.

It’s a Bricks global class, and I added the class to an empty div onto the canvas, just to load it in.

Now the styles are applied when addClass is triggered.

So you’re right addClass works fine. However, I’d expect it to load in the styles without having to manually add it in myself. I’m sure it’s complicated and can easily break in future updates of Bricks. At the very least, it might be a good idea to add a tooltip about how this works directly in the Bricksforge Panel. Just like you mentioned “CSS Class (Without Dot).” It would have saved me at least an hour of tinkering.

Anyway, thanks again, love the plugin!