NO BUG: Query Loop / Interactions - It is doing the interaction to all looped items instead of just the current item

Browser: Chrome 110
OS: Windows
URL: LocalWP
Video: Teste Dieta (Builder)

I’ve set some interactions to hide a button(hide itself) and show a block, and another one to hide the block(hide itself) and show the button again. I’m doing the attribute method (.display-none → set attribute / remove attribute). Also, the block uses the “.display-none” class as default, because I just want to show that block when the button with the interaction is clicked.

It works for the looped item which you click the button, but the issue is that it also loops the interaction to the other looped items. And the funny thing is that it just loops the block interaction, the interaction in the button works fine.

If anyone knows what is going on, I would appreciate a comment. :]

Best regards to all of you.

Hi @ribeirom4e,

as far as I see, you are targeting a class with your interaction. Now, this class is applied to all looped items. So, I believe that what’s happening here, is that once you click the interaction, not that all other interactions are run, but because you are targeting a class, it just also find all other elements.

What you will have to do is to figure out a way, how to have different classes on each loop item (maybe by post slug), and then target that.

Best regards,
Matej

Hello Matej, how are you?

No offense, but, you just rewrote in another way everything I already mentioned above, haha. That is why I posted this here, because I’m trying to find a solution. I don’t think targeting a post slug is a solution, because as explained above, I need to hide/show a block, not the entire item from the loop.

Thank you anyway for your comment. :]

Hi.

Maybe, because you posted in the bug section :slight_smile: I’ll mark this topic as no-bug, since it’s not really a bug :wink:

Anyway, the solution I had in mind looks like this (not sure why you said you don’t like it, any reason? )

  • On a query loop item, add a custom class, like {post_slug}. Feel free to add any prefix you need. After you add it, every loop item should have a unique class attached. You can also set it as ID if you want.
    slika.

  • For second step, just add interactions, and target elements inside this newly created class.

Now, when you click the button, it should only hide/show items in the query loop item itself.

Or you can use custom JS, then you don’t need these additional classes :slight_smile:

Matej

Didn’t work for me mate, but thank you for that.

Best regards,

Can you show me your setup? You can record a video or send a few screenshots.

Thanks.

https://www.awesomescreenshot.com/video/33118590?key=16717ad3f993186a58b41464375a536e

Hi @ribeirom4e,

in your interaction, you are targeting a class, because you have a dot before your dynamic data .{post_slug} , but in your setup, you set post slug as an ID. Please try to set it as a class, and check again.

Or, you can leave it on ID level, but instead of dot, use #.

Let me know,
Matej

Didn’t work.

I hope one day someone find a solution for this. I’ve already moved on and unfortunately created a JetEngine Listing (instead of using the Bricks Query Loop).

Would be cool to also get this one sorted out as well:

Best regards,

Hi,

I tested this, and this worked for me just fine :slight_smile: If you want me to check your website, why it’s not working, feel free to send temporary login credentials to your test/staging website and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase, so we can take a look?

Matej

1 Like

Interesting. I’m using Local, so no temp. login.

If you can, as I’m already abusing of your generosity haha, could you please create a video of your testing and post the link here?

Best regards,

Hi,

First, sorry for the very late reply. I was on a vacation :smiley:

Anyway, here is the video, if it still helps :wink:

Hopefully, you will manage to get it working.

Matej

Thank you very much my friend, I’ll try it later. :]

Hope that you had an awesome vacation.

1 Like

Thanks @Matej - it works perfectly for me - hiding a code element with iframe inside a query loop.

As the {post-slug} has to be on the query loop I combined it with a class on my code element. So the button interaction looks like this:

1 Like