Streaming live at 10am (PST)

Single Custom link in dynamic list?


#1

Hey all, i need a single item in my dynamic list to link out to another website and not a page in my project.

I need my ‘visual design’ object to link to my dribble page and not a page on my website

https://preview.webflow.com/preview/nicks-portfolio-v2?utm_source=nicks-portfolio-v2&preview=3ecc36c74801b5317cb8a1afd1aa14bf

Any help would be appreciated as this is rather urgent :frowning:


Here is my public share link: LINK
(how to access public share link)


#2

WOW :slight_smile: very problematic. No way to use conditional-visibility and use two kinds of buttons/links (if “open in blank” is true “hide X show Y”)

By custom code

var visualDesign =  document.getElementById("visual-design");
visualDesign.href = "http://www.cnn.com/";
visualDesign.setAttribute("target", "_blank");

image

image


#3

hmm this doesnt seem to work, I copied the exact code you did and it still links me to the page within my project.

I also tried a different way of implementing an external link like this

<Script>
 var visualDesign =  document.getElementById("visual-design");
 visualDesign.href = <a href="https://dribbble.com/nick-lamela" rel="external">External link</a>
 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"> . 
  <script type="text/javascript">
   $('a[rel="external"]').attr('target', '_blank');
    </Script>

#4

You change my code (Your code is wrong).

First no need to load Jquery (Webflow already load jquery).

  • The code will work only in the live url (Not in designer/preview/editor mode).
  • Remember to select the link tag!! (We want to change the href)

My code with docs:

1

<script>

open script tag

2

store element inside var - by getElementById method Docs

var visualDesign =  document.getElementById("visual-design");

3

Change Href. Docs

visualDesign.href = "http://www.another-site.com/";

4

the setAttribute() method adds the specified attribute to an element, and gives it the specified value. Docs

visualDesign.setAttribute("target", "_blank");

5

close script tag
</script>