Hi! I’m not a coder, but trying… slowly but surely. I have finally figured out the following code to link the background of each box in a repeater, but the problem is, each box is just linking to the first link in my database. How can I edit this code to make each box link to its own url? I know I saw another forum post about this in the past, but I can’t seem to find it!
$w.onReady(function () {
$w(‘#repeater1’).onItemReady((selector, itemData, index) => {
$w(‘#BlogBackground’).onClick(() => {
winLocation.to(itemData.link);
});
});
});
Hello Gabrielle,
You can define it without using a code, with the next steps:
Attach transparent button to repeater (it will be duplicated cross all containers)
Connect repeater to a dataset
Connect the button link to the same dataset (link to the link from DB)
Here is my sample: https://wix-alex.wixsite.com/mysite-111
Or,
Use the forEachItem() function to run a function on all of a repeater’s repeated items:
*Be sure that container and repeater - connected to the same dataset (otherwise, all containers will have the data from the first row in DB)
Thanks.
Thank for the help, Alexander Jdanov. I’ve tried the invisible button, but I don’t like that the button then makes each repeater box all the same size. I prefer having each box different sizes according to their content.
I would love to try the ForEachItem function, but I’m not sure where to put it in. Where would I add it into the code I pasted above?
Thanks!
thank you I have been looking for this everywhere.
MAN !! from the buttom of my heart THANK YOU !!
i have been looking for this since 3 hell days !!
THANK YOU VERY MUCH ![:smiley: :smiley:](/images/emoji/google_classic/smiley.png?v=12)