Jump to content

Help needed with 'on-scroll' lottie files

Recommended Posts

Hey there everyone

Newbie here looking for some help. We're building a site on 7.1 tand we want a lottie to animate on scroll. At the moment we can't get it to work at all. It doesn't start scrolling, and when 'autoplay' and 'loop' are removed from the code block the lottie disappears. Can anyone help tweak the code?

This is what we have at the moment:

In Code Block container

<lottie-player id="firstLottie"

autoplay

src="https://lottie.host/34ce465b-cd91-4cc8-bc1a-b2ed33f9600f/OFCFTqFgzG.json"

style="width:100%; height: auto;">"></lottie-player>

 

Code injection in Header:

<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>

<script src=&#x22;https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js&#x22;></script>

 

Code injection in footer:

<script>

  LottieInteractivity.create({

    player: "#firstLottie",

    mode:"scroll",

    container: "#block-yui_3_17_2_1_1696515827607_2322",

    actions: [

      {

        visibility: [0, 1.0],

        type: 'seek',

        frames: [0, 150],

      },

    ]

  });

</script>

 

 

Any help would be very much appreciated!

 

Link to comment
  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Thanks so much for your advice. I have updated the header script to:

<script src=&"x22;https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js&"x22;></script>

Unfortunately the animation is still not working on scroll. I'm not sure if I have not properly followed your advice, or if there is some other error. Are you able to advise on any further steps please?

Many thanks!

Link to comment

Your comment still miss " " symbol, try this

<script src="https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js"></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
  • 3 weeks later...

I'm having the same issue! I'm unable to get any Lottie animations working on scroll.

My code currently reads as:

Code Block container

<lottie-player id="firstLottie" autoplay src="https://lottie.host/34ce465b-cd91-4cc8-bc1a-b2ed33f9600f/OFCFTqFgzG.json" style="width:100%; height: auto;">"></lottie-player>

<lottie-player
id="firstLottie"
src="https://lottie.host/28c136cb-c77b-47fc-b467-134670c6f445/MBNi5RAJkP.json"
style="width:100%; height: 100%;">"></lottie-player>

 

Code injection in Header:

<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>

<script src="https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js"></script>

 

Code injection in Footer:

<script>
LottieInteractivity.create({
player: "#firstLottie",
mode:"scroll",
container: "#block-yui_3_17_2_1_1696515827607_2322",
actions: [
{
        visibility: [0, 1.0],
        type: 'seek',
        frames: [90, 123],
]
});

Does anyone have any thoughts or advice? 

Link to comment
On 11/3/2023 at 5:09 PM, Elsbth said:

I'm having the same issue! I'm unable to get any Lottie animations working on scroll.

My code currently reads as:

 

Code Block container

<lottie-player id="firstLottie" autoplay src="https://lottie.host/34ce465b-cd91-4cc8-bc1a-b2ed33f9600f/OFCFTqFgzG.json" style="width:100%; height: auto;">"></lottie-player>

<lottie-player
id="firstLottie"
src="https://lottie.host/28c136cb-c77b-47fc-b467-134670c6f445/MBNi5RAJkP.json"
style="width:100%; height: 100%;">"></lottie-player>

 

Code injection in Header:

<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>

<script src="https://unpkg.com/@lottiefiles/lottie-interactivity@latest/dist/lottie-interactivity.min.js"></script>

 

Code injection in Footer:

<script>
LottieInteractivity.create({
player: "#firstLottie",
mode:"scroll",
container: "#block-yui_3_17_2_1_1696515827607_2322",
actions: [
{
        visibility: [0, 1.0],
        type: 'seek',
        frames: [90, 123],
]
});

Does anyone have any thoughts or advice? 

Can you share link to page?

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
  • 2 weeks later...

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.