Jump to content

Making Portfolio Unclickable

Recommended Posts

Site URL: https://www.tgthrco.com/about

Hi all - if you go to my website (tgthrco.com/about) you'll see a few words listed towards the bottom that have an image appear on hover (empathy, purpose, growth, courage). I'm trying to remove the click functionality on them as I don't want them to link to a page. Any idea how to do this? I tried the following but it isn't working. 

a.portfolio-hover-item[href="/about/empathy/"] {pointer-events: none;}

Link to comment

You can add the following JavaScript code that will prevent the default functionality of links being clicked:

(function(){

  var links = document.querySelectorAll('a.portfolio-hover-item');

  // Loop over all of the portfolio links and prevent their default 
  // functionality from triggering when clicked.
  [].forEach.call(links, function(link) {
    link.addEventListener('click', function(evt){
      evt.preventDefault();
    })
  });

})()

See article on how to add JS. I would add it to the footer. 

Edited by jpeter

Full stack developer who loves helping people out with anything web related. If you'd like to support me, buy me a coffee!

Link to comment

you can wrap above code with script tag & add to Portfolio Page Header or Settings > Advanced > Code Injection > Footer

The comple code should be

<script>
  (function(){

  var links = document.querySelectorAll('a.portfolio-hover-item');

  // Loop over all of the portfolio links and prevent their default 
  // functionality from triggering when clicked.
  [].forEach.call(links, function(link) {
    link.addEventListener('click', function(evt){
      evt.preventDefault();
    })
  });

})()
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.