Linking a strip column to external URL


Please see the attached image. I would like to link the column on the right (image as background) to that website’s URL. Is there a way I can do so using Wix Code? Thanks in advance!

1 Like

Hi Adam,
Yes, it’s possible :slight_smile:
Select the column, and in the properties panel add an onClick event handler.
In that event handler you can use “wix-location” to navigate to any link you want.
Example code:

import wixLocation from "wix-location";

export function column2_click(event, $w) {
	wixLocation.to("https://www.google.com",)
}

Give it a go and let us know if it works.

3 Likes

Thank you Tomer. You’ll have to forgive me, as I’m brand new to coding in general. When I add an onClick event handler to the column image, there is already code. Do I replace it with the code you’ve provided above? Or insert it in a specific line?


The attached screenshot is what I see once I add on “onClick”.

Hi,
You need the import statement from my code - in order to use “wix-location”.
Then inside your event handler (column19_click) use “wixLocation” to navigate to your desired link, similar to the code I wrote.


Hello Tomer,

Please see the attached screenshot. The link does still not work.

The yellow notification says “parameter ‘event’ is never used” and “parameter ‘$w’ is never used”.

The red notification says “wixLocation” is undefined.

Are you able to help me out? I’m brand new to coding so I don’t know how any functions work.

Hey.

I just had the same problem, and I think I found the solution. I have 3 columns with seperate background images, and I made them into url links like this:
Just remember to paste the whole https, with the " " marks in each end included, and end the line with a ; and a }

$w.onReady(function () {
//TODO: write your page related code here…

});
import wixLocation from “wix-location”;

export function column14_click() {
wixLocation.to(“Redirecting...”,);
}

export function column16_click() {
wixLocation.to(“https://www.youtube.com/MYINFO”,);
}

export function column17_click() {
wixLocation.to(“(@MYINFO) • Instagram photos and videos”,);
}

I would like to know if it is possible to link a Column to a different site without programming? I have a Background which i want to link to a different site.

Hi,
You can add a url field to the database with the wanted address and link it in the table (without programming).
Roi.

Tomer,

What you answered initially to Adam is actually what I am looking to do, but I have the same question he does. Do I copy and paste your code somewhere within the code that comes up automatically when clicking OnClick, or do I completely erase that code and just use yours?

I’ve tried it a few different ways an it is not working, but I am linking to a page on my own website.

Actually i figured it out, it just wasn’t working in preview. Do you have to link it to a full url or is there a way to just use a page name if it’s your own page

1 Like

You should be able to use just the page name, for the actual link structure please see the wix-location documentation

1 Like

Great, thanks so much

Thank you Tomer for your help and Dave for contributing.

1 Like

Hello!
I am trying to link a column image to a page on my website and I have tried everything here but it still will not go to the page. Anyone know how to fix this?

1 Like

I’m having the same issue. Would like to link a series of images that the EDI editor set up as a series of Strip images on my page. I’d like each image in the Strip to link to a different site page. Any advice?

Hi ALL, I just figure out what happened.
Overall, the code is all right, nothing wrong with the code.
YOU JUST NEED to open the properties panel, and click the onClick button on each column!
That’s it!
Hope helps someone.

1 Like

I CANT MAKE IT WORK