Jump to content

Make images clickable in the carousel

Recommended Posts

On 2/7/2023 at 8:58 PM, yuliamazur said:

Hey @tuanphan! Thanks for your help!

I'm using the commercial plan so I think I'm able to insert the new code. Please send the new one when you can, I'd appreciate this very much!!! 

I think the above code is fine. You can also make code shorter by adding this to Page Header (page where you added Carousel)

<style>
  li.list-item {
    position: relative;
}
.list-item-content__button-container {
    position: static;
}
a.list-item-content__button.sqs-block-button-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    color: transparent !important;
    background-color: transparent !important;
}
.list-item-content__button-container {
    position: static !important;
}
.user-items-list-carousel__slide {
    pointer-events: initial !important;
    user-select: unset !important;
}
.user-items-list-carousel__gutter {
    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!)

Link to comment
6 hours ago, tuanphan said:

I think the above code is fine. You can also make code shorter by adding this to Page Header (page where you added Carousel)

<style>
  li.list-item {
    position: relative;
}
.list-item-content__button-container {
    position: static;
}
a.list-item-content__button.sqs-block-button-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    color: transparent !important;
    background-color: transparent !important;
}
.list-item-content__button-container {
    position: static !important;
}
.user-items-list-carousel__slide {
    pointer-events: initial !important;
    user-select: unset !important;
}
.user-items-list-carousel__gutter {
    cursor: pointer;
}
</style>

 

Thank you! You're right, the above code was fine! 

But I was facing another problem with it... It didn't let me click & drag the objects of carousel. I've explained this in this comment and added some screen recordings 

 

After that you told me that you have a solution but I'll need another code for this. Do you still have it? I appreciate your help very much

Thank you in advance!

Link to comment
On 2/11/2023 at 3:31 PM, yuliamazur said:

Thank you! You're right, the above code was fine! 

But I was facing another problem with it... It didn't let me click & drag the objects of carousel. I've explained this in this comment and added some screen recordings 

 

After that you told me that you have a solution but I'll need another code for this. Do you still have it? I appreciate your help very much

Thank you in advance!

Yes. You can remove CSS code I sent, I will give new Java code

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
On 2/18/2023 at 3:13 AM, SlocumMarketing said:

I've poured through this and the original code works but I'm wondering how to make it so that the buttons remain?

What is site url? We can use script code to do this

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
  • 2 weeks later...
On 3/2/2023 at 12:43 AM, digiav4mac said:

Hello,  I would like to have clickable carousel images too.  Is there also a way to light box them?

https://www.casasymari.com/bryce

You will keep button or need to hide it?

Click Image >> Show Description in Lightbox or show large image in lightbox?

On 3/4/2023 at 1:38 AM, SlocumMarketing said:

Hi there,

Website isn't live yet but you can see it here.

https://gopher-pike-pb3p.squarespace.com/ PW: Slocum

You mean this?

image.thumb.png.ca664bc382b4115a89d27f0594c8edd5.png

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
On 3/6/2023 at 6:57 PM, fancylamp said:

Hello, 

would be grateful if you could give me the code for this too! I have added the buttons below each image but would like to hide them and have the image linked instead. Thanks very much. @tuanphan

https://www.collectablecities.com/

(for the carousel below the top banner)

Add to Design > Custom CSS

/* Make carousel clickable */
.user-items-list-item-container[data-section-id="63b964798747bf1277de70bd"] {
li.list-item {
    position: relative;
}
.list-item-content__button-container {
    position: static;
}
a.list-item-content__button.sqs-block-button-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    color: transparent !important;
    background-color: transparent !important;
    border: none !important;
}
.list-item-content__button-container {
    position: static !important;
transform: unset !important;
}
a.list-item-content__button.sqs-block-button-element:before {
    visibility: hidden;
}
.user-items-list-carousel__slide {
    pointer-events: initial !important;
    user-select: unset !important;
}
.user-items-list-carousel__gutter {
    cursor: pointer;
}}

 

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
On 3/6/2023 at 1:34 PM, tuanphan said:

You will keep button or need to hide it?

Click Image >> Show Description in Lightbox or show large image in lightbox?

You mean this?

image.thumb.png.ca664bc382b4115a89d27f0594c8edd5.png

Add to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
  $( ( ) => {
  
    const selector = '.user-items-list-carousel__slides .list-item';
    
    $( selector ).each ( function ( ) {
    
      const $this = $( this );
      
      $( $this ).click ( function ( ) {
      
      const url = $( '.list-item-content__button', $this )
      
        .attr ( 'href' );
        
      $( `<a href="${ url }" target="_blank">` )
      
      	.get ( 0 )
        
        .click ( );
        
      } );
      
    } );
    
  } );
</script>
  <style>
.user-items-list-item-container[data-section-id="63ee67026492330cee6c0212"] .user-items-list-carousel__slide {
    pointer-events: initial !important;
    user-select: unset !important;
}
.user-items-list-item-container[data-section-id="63ee67026492330cee6c0212"] .user-items-list-carousel__gutter {
    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!)

Link to comment
1 hour ago, tuanphan said:

Add to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
  $( ( ) => {
  
    const selector = '.user-items-list-carousel__slides .list-item';
    
    $( selector ).each ( function ( ) {
    
      const $this = $( this );
      
      $( $this ).click ( function ( ) {
      
      const url = $( '.list-item-content__button', $this )
      
        .attr ( 'href' );
        
      $( `<a href="${ url }" target="_blank">` )
      
      	.get ( 0 )
        
        .click ( );
        
      } );
      
    } );
    
  } );
</script>
  <style>
.user-items-list-item-container[data-section-id="63ee67026492330cee6c0212"] .user-items-list-carousel__slide {
    pointer-events: initial !important;
    user-select: unset !important;
}
.user-items-list-item-container[data-section-id="63ee67026492330cee6c0212"] .user-items-list-carousel__gutter {
    cursor: pointer;
}
</style>

 

Thanks so much!!! Is there a way to make it so it doesn't open in a new tab?  No worries if not but would be optimal if it's possible.  Thanks!

Link to comment
On 3/10/2023 at 10:46 PM, SlocumMarketing said:

Thanks so much!!! Is there a way to make it so it doesn't open in a new tab?  No worries if not but would be optimal if it's possible.  Thanks!

Just change _blank to _self

image.png.4e851659aff1daa4964f2bfee3b5f56b.png

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

Hi All, I have the exact same issue.  I have never done any coding, but I know how to copy and paste!

If there is anybody who can talk a total newb through this I would be very very grateful.  

The site is:  https://www.valueresonance.space/

Here is a screenshot.  I want to make each image clickable to head to their respective pages.

I added the buttons as instructed above.

I see where to add code.  

image.thumb.png.7365f1d21a452aa636c1d71b939edb73.png

Not sure if this is the correct place.

I have been trying to copy-paste some of the code above into Design>Custom CSS to see what happens.  So far nothing works.  I am assuming you guys are asking for the URL because there is something in the code specific to that URL, but not sure what it is to edit it.  I don´t see a URL in the code.

Also, each image will go to a different URL, so where will I add the individua URLs for the destination pages for each image? (Update, I think addingthe individual buttons with URL per image deals with this).

I keep experimenting and hope somebody can help.  TX

 

 

 

 

 

 

image.png

 

Edited by ValueResonance
Update
Link to comment

I've got a similar request. Would like to have a carousel with hidden buttons. 

I've pasted the code from earlier suggestions but it's acting funny, it hides the buttons (great!), but the heading and image are only clickable once in a while, e.g. after I click inspect in the Chrome browser. otherwise I can only drag the images. Any suggestions?

Also, will have a similar carousel on multiple pages, can I add multiple section ID's to add same feature on multiple pages?

Page 1:  https://kumquat-clementine-584b.squarespace.com/barcode-1

Page 2: https://kumquat-clementine-584b.squarespace.com/barcode-2

(and then some more pages that I haven't created yet)

 

Link to comment
On 3/10/2023 at 1:55 PM, tuanphan said:

Add to Design > Custom CSS

/* Make carousel clickable */
.user-items-list-item-container[data-section-id="63b964798747bf1277de70bd"] {
li.list-item {
    position: relative;
}
.list-item-content__button-container {
    position: static;
}
a.list-item-content__button.sqs-block-button-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    color: transparent !important;
    background-color: transparent !important;
    border: none !important;
}
.list-item-content__button-container {
    position: static !important;
transform: unset !important;
}
a.list-item-content__button.sqs-block-button-element:before {
    visibility: hidden;
}
.user-items-list-carousel__slide {
    pointer-events: initial !important;
    user-select: unset !important;
}
.user-items-list-carousel__gutter {
    cursor: pointer;
}}

 

Thanks for getting back to me. I've added to Design > CSS but it hasn't seemed to work, do you know why? 

Link to comment

@fancylamp@tuanphan

yes.  I have the same problem.

I noticed that in the thread above, the dev was asking for the URL.  So this tells me that there is something specific to the URL in the code.  However, I don´t see any url or path in the code.  If we could identify what it is that is specific to the URL, then perhaps we can edit the code and make it work?

I realised that the individual buttons for each image need adding so that the individual url for each image is already there, so this code is supposed to hide the button and make the image into the button.   

I suspect that the part:  

data-section-id="63b964798747bf1277de70bd"]

probably needs editing, as this seems to be an identifier specific to the URL.  The question is, where do we find this ID?  and is this the only thing that changes? 

image.thumb.png.f7ef809bae27a6ced75ddbf48c30fbbc.png

Update:

 

Found this and replaced the ID number to see if it works, but still not working, so that was not it! 

image.thumb.png.492bfeee1cc102d206cb549f9cf980c7.png

Edited by ValueResonance
Link to comment

@fancylamp

Solved!!!

I was correct that the 

[data-section-id="63eeb40b075f7e3683b0592a"] 

is what needs editing.

I do not know how to identify which number to put in, so here is what I did.

CTRL U (to see code) on your page.

Then CTRL F to `find´(search)

Then I put:  `data-section´ in the search box:

image.thumb.png.c202ef692014368a16df2fe2ea256e4b.png

 

Ans then by trial and error, I copy pasted each ID number into the original code.  as you can see on my site there are 52 instances.  I found the one at no. 12

Here you can see I have it working now:

https://www.valueresonance.space/

Unfortunately, I lost the `dimming´ when you hover over the image, to indicate that there is a click there.  but the button is gone and the links are working!

Now I need to figure out how to get the `hover-dimming´ or whatever that is called, back!

perhaps @tuanphan can help with adding the dimming back in?

Good luck

  

 

 

 

 

 

Edited by ValueResonance
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.