Linking a column to a link!

Im doing everything but it doesn’t work for me! Probably another bug on my blocsapp, one of many hehe

I’m curious,
did you copy and paste the code or did you type it yourself?
I found out that the single quotes when you copy and paste them don’t work.
So try to type them on your keyboard.

You are right! working now! uff thanks a lot!!

Strange, isn’t it?

@Hypnoman, @hendon52,
I thank you both.
Is there a way to implement a target like “blank” ?

1 Like

Yes, but you have to add a small script element to your page head. The code you add will be:

<script>
function myFunction() {
  window.open("https://yourURL");
}
</script>

Add your code as indicated in the illustration below:

In your page you would add the onlick attribute to the column as:

Name: onclick
Value: myFunction ()

This will result in the URL opening in a new tab or window.

Sorry for the late reply.
OK, that works fine. But …
What if you need more different urls for more clickable columns?

Thanx for your help anyway.

Just have a different function name for each one (myFunction1 myFunction2 etc. or something completely different), Functions are like your children, you can give them any names you like its up to you.

I’ve thought of that. But … :wink:
When I have 10 different columns I will end up with 10 different scripts in the page header.

If you have 10 URLs then you will need to create 10 functions. However, the code is very small. 10 functions would be about 700 bytes - so not very heavy. To speed things up, just use copy and paste and then edit each function name and its url. You are going to have to add the URL’s to the page somewhere anyway so you may as well load them all in one place.

This is how you combine multiple functions and URL’s in an easy to read and edit format.

<script>
function myFunction1() {
  window.open("https://youtube.com");
}

function myFunction2() {
  window.open("https://google.com");
}

function myFunction3() {
  window.open("https://wikipedia.com");
}

function myFunction4() {
  window.open("https://yourURL4");
}

function myFunction5() {
  window.open("https://yourURL5");
}

function myFunction6() {
  window.open("https://yourURL6");
}

function myFunction7() {
  window.open("https://yourURL7");
}

function myFunction8() {
  window.open("https://yourURL8");
}

function myFunction9() {
  window.open("https://yourURL9");
}
</script>

Total size is about 590 bytes.

2 Likes

Thanx @hendon52.
Your help is much appreciated.

1 Like

Hi guys,

In Blocs 3.5, you can now just add a class .stretched-link to a link inside a card or column, and it will make the whole column or card clickable.

I have made a video tutorial showing how to do that.

Cheers,
Eldar

8 Likes

Gold!! Thank you so much! You just saved me from adding the links manually all the time!!!

Very cool to know about this @Eldar thanks mate.

1 Like

I just tried and it didn’t work for me! Any idea why? Im on blocs 3.5

Hello @Eldar I have noticed that this stops working as soon as you add a new row to the card or colunm. The same thing happens to you?

I don’t have my Mac with me to check, but maybe you can read this article to understand how it works.

Please let us know if you if you do the test! All the examples are based on a single row so that mean it wouldn’t work on something like your hotel template for example?

Im trying to make it work on something similar!

No, it did work on my hotel and a couple of other templates without a problem. I will check later and come back.

Thanks a lot!