Hi yall, new at this. Using mouseIn / mouseOut to create a hover effect on a repeater, but I can’t figure out how to limit it to each item. If you check out this URL and scroll to the featured section you’ll see where I’m at, when you hover over one, it shows the effect on all the items. Ugh.
This is the little bit of code I’m working with. Container = each item in the repeater. Box = the hover elements:
export function container1_mouseIn(event) {
// Add your code for this event here:
$w('#box1').show()
}
export function container1_mouseOut(event) {
// Add your code for this event here:
$w('#box1').hide()
}
Howdy! Thanks for the response. I just tried this and sadly the same thing happens. The same effect is achieved, but it just shows up on the entire repeater instead of each individual item I’m hovering over…
Hi! I do something similar on my site. I think you may find this post useful. And this API documentation will explain it better than me.
Basically, you’ll need to use $item instead of $w . That way the event will be limited to each individual item in the database/repeater, instead of to the specific element ID.
I haven’t tested this code, but something like this:
export function container1_mouseIn(event) {
$w("#repeaterName").onItemReady(($item, itemData, index) => {
if (event.context.itemId === itemData._id) {
// #box1 is the id of all the boxes, but $item maps through each button on the repeater
$item("#box1").show();
}
})
}
Hey again y’all - I’m working with this bit of code that LMeyer wrote up, but I’m having a little trouble with it. The hover effect is working but it’s slow and glitchy. Could anyone point me in the right direction to fix this?
Hi again! This post could be helpful to you if you want to add effect options to smooth out the animation.
And here is the API for all possible effects you could mess around with.
This works for me in preview, but once published it doesn’t quite work. When I hover over one of the items in the repeater, all the ones I’ve hovered over previously activate too. Any ideas?