Jump to content
Search Community

Split Text break points issue on Safari

that_guy_josh
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

that_guy_josh
Posted

I'm having an issue with my SplitText and ScrollTrigger setup. The effect is to paint each line blue as the user scrolls. It renders perfectly on Chrome but on Safari (desktop and IOS), the line breaks happen in weird places.

I recreated the animation in CodePen but couldn't replicate the issue in Safari, so not sure what's happening. For further context, I am building in WordPress using Bricks Builder, so there maybe a script conflict? Not sure, but any help is greatly appreciated!

CODE:

export function highlightTextOnScroll() {
  gsap.registerPlugin(ScrollTrigger, SplitText);

  document.fonts.ready.then(() => {
    SplitText.create(".scroll-highlight", {
      type: "lines",
      linesClass: "line",
      autoSplit: true,
      onSplit: (instance) => {
        const animations = instance.lines.map((line) => {
          return gsap.to(line, {
            backgroundPositionX: 0,
            ease: "none",
            scrollTrigger: {
              trigger: line,
              scrub: true,
              start: "top center",
              end: "bottom center",
            },
          });
        });
        return animations;
      },
    });
  });
}

CHROME:image.thumb.png.89abacd2756df59edce522564dc4e678.png
SAFARI:
image.thumb.png.bb296b28ffb75c7ec98e669be23dedfb.png

See the Pen dPodvvj by josh_mitch (@josh_mitch) on CodePen.

that_guy_josh
Posted

I actually just found the issue: I have text-wrap: balance set on all my heads in my CSS reset and this seems be causing the issue on Safari browsers. 

I'm not sure if this is a bug then and needs to be addressed?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...