Jump to content

Pinned image not working correctly on ipad

Recommended Posts

Posted

Site URL: https://seadragon-marlin-z77k.squarespace.com/

I have pinned images with text that scrolls up on several places on my site (twice on homepage and once on About. I have it set not it display on mobile ( in some instances creating separate mobile sections). I am happy with it on my laptop and phone but on ipad it shows the color block under the image as it scrolls. Hard to capture in a photo as it's moving but I attached a screen shot from my ipad. I did some Googling and it seems like this is a regular issue with pinned images but I also couldn't quite find the solution. 

Code: 1234

 

I'd appreciate it if anyone has time to take a peek! Thanks! 

 

Screenshot2024-11-16at7_27_21PM.thumb.png.403c24d314a68a5f2e86816d63294f61.png

Posted

@tuanphan - I appreciate the attempt but this unfortunately did not fix it. I had tried something similar when I first set up the pinned image. I just tried your code as well hoping that mine was just a little off.  I don't think I will have a ton of iPad views for this site but it's still driving me crazy that I can't figure it out. 

Posted

Directions:

Add a List Section with it’s design set to “Simple List”.
In the List Section settings:
Set Max Columns to 1
In the Style area, enable the Card setting
Turn on “Show Image”, “Show Title”, “Show Body”, “Show Button”
Paste in the CSS to your custom CSS area and replace any of the variables as you’d like!
Add this code into custom css:

section[data-section-id="123"] .user-items-list-simple{
  li.list-item {
    @base-top: 25px;
    @num-elements: 5;
    @sticky-start: 100px;
    @sticky-start-mobile: 50px;

    --desktop-height: 400px;
    --mobile-height: 600px;
    --mobile-image-height: 200px;
    --max-width: 800px;
    --border-radius: 20px;

    display: grid;
    grid-template-columns: 1fr 1fr;
    position: sticky;
    overflow: hidden;
    top: 200px;
    box-shadow: 2px 2px 8px hsla(0, 0%, 0%, 0.12);
    border-radius: var(--border-radius);
    padding:0px !important;
    height: var(--desktop-height);
    max-width: var(--max-width);
    margin:auto;

    .list-item-content{
      grid-row: 1;
      overflow: auto;
    }
    .list-item-media{
      margin-bottom:0px !important;
    }
    .list-item-media-inner{
      padding: 0px !important;
      height: 100% !important;
    }
    .list-item-content{
      padding: 17px;
      display: flex;
      flex-direction: column;
    }

    @media(max-width: 767px){
      // Uncomment the two settings below to disable this effect on mobile
      // position: relative;
      // top:0 !important;

      grid-template-columns: 1fr;
      height: var(--mobile-height);
      .list-item-content{
        grid-row: 2;
      }
      .list-item-media-inner{
        min-height: var(--mobile-image-height);
      }
    }

    // Generate Offsets
    .generate-offsets(@i) when (@i > 0) {
      &:nth-child(@{i}) {
        top: (@base-top * @i) + @sticky-start;
      }
      @media(max-width:767px){
        &:nth-child(@{i}) {
          top: (@base-top * @i) + @sticky-start-mobile;
        }
      }
      .generate-offsets(@i - 1);
    }
    .generate-offsets(@num-elements);
  }

  &[data-alignment-vertical="bottom"] .list-item-content{
    justify-content: end;
  }
  &[data-alignment-vertical="top"] .list-item-content{
    justify-content: start;
  }
  &[data-alignment-vertical="middle"] .list-item-content{
    justify-content: center;
  }
}

 

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.