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. :]
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.
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.
Maybe, because you posted in the bug section I’ll mark this topic as no-bug, since it’s not really a bug
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.
.
For second step, just add interactions, and target elements inside this newly created class.
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.
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:
I tested this, and this worked for me just fine 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?