samisfierce Posted December 31, 2021 Share Posted December 31, 2021 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
jpeter Posted December 31, 2021 Share Posted December 31, 2021 (edited) 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 December 31, 2021 by jpeter tuanphan 1 Link to comment
tuanphan Posted January 2, 2022 Share Posted January 2, 2022 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 How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment