SOLVED: Dynamic data not working for background-color inside query loop

Bricks Version: 1.5.1 RC
Browser: Chrome 104
OS: Windows / Linux
URL: https://isa.b32.be/

I have setup a query loop which work very well with ACF dynamic data except for one field, it’s the background color, bricks only take into considération the background color of the first post and apply the same color to the other posts:

Here we can see that I have use the same string for the title and the background-color of the post, first post has a background-color set at: var(–primary-trans-40), meanwhile title change for the two other post, it’s the background color of the first post which get applied to all the posts.

If I set the second post first, the 3 post will have a background color of the new first post: var(–secondary-trans-40):

And if I put the third post first, it will change the 3 background color of that tird post var(–accent-trans-40):

Thanks and Regards,

Nicolas.

1 Like

Hi Nicolas,
Thank you very much for your report!

The problem is that each div gets the same class and, therefore, the same color.

I think the only way to solve this is to add the dynamic color as an inline style attribute. Can you give this a try?

Best regards,
timmse

1 Like

Thanks timmse, it works like a charm :slight_smile:

Always embarrassing when solution seems so simple and that I could thing about it!

But I guess that’s why we’ll always need expert :wink:

Thanks again!

1 Like

Hello @timmse , if I want to change the background color when hovering over an element, how could I do it?

a status update would really help. thanks.

About the status of…? If you apply styling inside a loop (e.g. on a class), it’s expectable that every element using that class gets the same styling, isn’t it?

thanks for such a great obvious answer. sorry for asking!

What I don’t understand now is that, is the background color coming from ACF, or from the Bricks Builder loop. Because the attribute set will have to retrieve colours for various backgrounds from somewhere it has been stored.

I checked ACF and it has nowhere to set colours, like for taxonomies or fields. So how does that attribute get different colors for the query loop?

1 Like

The author of the report (nickwe) has created an ACF color field for his posts and assigns a color to each post, which he then outputs within the loop via the style attribute.

1 Like

Is this background color problem solved or still there?
Thanks

Hi @aryanshirani ,
This was not a bug at the time and is, therefore, no longer relevant.

What exactly is the current problem?