Jump to content

Make carousel images clickable with buttons underneath

Recommended Posts

Posted

Site URL: https://www.brieckboogaard.com/

Hello,

I want to make my images on my portfolio page clickable. This helps direct the user to the corresponding page. I have already add buttons underneath and want to keep them too. 

Is there someone who can write a CSS code to keep the buttons and make the images clickable with corresponding pages?

Thank you in advance. 

Screenshot 2024-10-07 at 18.56.26.png

  • Replies 1
  • Views 431
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Posted

You can use this to Website Tools > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
  $('body.homepage .list-item-media img').on('click', function() {
    var link = $(this).closest('.list-item').find('a.list-item-content__button').attr('href');
    if (link) {
      window.location.href = link;
    }
  });
});

</script>
<style>
.list-item-media {
    cursor: pointer;
}
</style>

 

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!)

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.