Hi, I’m working with Wix Editor, and I’m trying to implement a middle mouse button click on repeaters, so I can open each element’s link in a new tab. No luck so far. How can this be achieved?
Thanks in advance for any tip!
Hi, I’m working with Wix Editor, and I’m trying to implement a middle mouse button click on repeaters, so I can open each element’s link in a new tab. No luck so far. How can this be achieved?
Thanks in advance for any tip!
Any hints on this?
The middle mouse button does seem to work in gallery elements… Might I be doing something wrong with repeaters?
Middle mouse click is not a property in the velo, there is onClick property though. However, you can use the custom elements instead of repeater to add this feature. I can give you more insight or codes if its not too complex if you can give me more context of the use case. ![]()
Thanks for the reply!
Hum, I see…
In my case, I have multiple repeaters where each one’s elements link to new (dynamic) pages that are previously created (by the time each element displays on the repeater, its page already exists).
Right now I’m setting up each repeater’s element top container to be clickable like this:
export function setupClickableContainer(container, url) {
if (!url || !container) return;
try { /** @type {any} */ (container).link = url; } catch (e) {}
container.onClick((event) => {
if (event && event.button === 1) {
try {
const g = Function('return this')();
if (g && typeof g.open === 'function') g.open(url, '_blank');
else wixLocation.to(url);
} catch (e) { wixLocation.to(url); }
} else {
wixLocation.to(url);
}
});
}
By the way, currently when middle-button clicking, it simply displays the page scroll arrows as when you do it on any webpage.
Please let me know if you need any extra info!
Thanks in advance!
Are repeaters connected to CMS?
Yes! Sorry, forgot to mention that (very) important detail!
Every repeater element comes from a collection that has a Page Link field, which is passed to the function above to be accessed upon clicking it.
I See..
if you can give me the collection info like collection ID, field IDs, and elements needed in item, I can build a custom element code for you that supports middle mouse click function…
Thank you for your help!
Each element has quite a lot of elements, and I want to keep my website as simple as possible to avoid any complex maintenance problems, so I think it would be better to avoid custom elements because of an issue like this
If there is no simple way, then for the time being I’ll leave this issue aside.
By the way, the middle click works in gallery items… Do galleries have some kind of different properties when compared to repeaters regarding clicking?