Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- split-me is the class of the container which can contain one or more Elements to split. Do note that it might contain another div inside which will have a children that is to be split. For Example: .split-me > .my-div > p--->

<div class="split-me">
  <h1>Lorem Ipsum </h1>
</div>
<div class="split-me">
  <h2>is a </h2>
</div>

<div class="split-me">
  <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! Distinctio.</p>
</div>
<div class="split-me">

  <h2>is a </h2>
</div>
<div class="split-me">
  <h1>Lorem Ipsum </h1>
</div>
<div class="split-me">
  <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! Distinctio.</p>
</div>
<div class="split-me">

  <h2>is a </h2>
</div>
<div class="split-me">
  <h1>Lorem Ipsum </h1>
</div>
<div class="split-me">
  <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! Distinctio.</p>
</div>
<div class="split-me">

  <h2>is a </h2>
</div>
<div class="split-me">
  <h1>Lorem Ipsum </h1>
</div>
<div class="split-me">
  <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! DistinctioLorem ipsum dolor, sit amet consectetur adipisicing elit. Voluptatum, possimus ullam nostrum facere ipsam in molestias iure ea numquam perspiciatis unde quasi eveniet. Nesciunt ea eligendi tempore aperiam molestiae! Distinctio.</p>
</div>
              
            
!

CSS

              
                .split-me {
  font-size: 2rem;
  font-weight: 400;
}

.split-me .line-wrapper {
  overflow: hidden;
}

.line {
  will-change: transform;
}

              
            
!

JS

              
                /* Selectors to animate inside the DIV */
var jQuerysplit = jQuery(
  ".split-me h1, .split-me h2, .split-me h3, .split-me h4, .split-me h5, .split-me h6, .split-me p, .split-me li"
);

/* Splitting Lines */
const splitLines = new SplitText(jQuerysplit, {
  type: "lines",
  linesClass: "line line++"
});

/* Wrapping the Lines in a DIV with class line wrapper to make animation */
jQuery(".split-me .line").wrap('<div class="line-wrapper">');

/* GSAP Animation */
gsap.utils.toArray(".line").forEach((el) => {
  gsap.from(el, {
    yPercent: 200,
    stagger: 1,
    duration: 3.5,
    stagger: 1,
    ease: Expo.easeOut,
    scrollTrigger: {
      trigger: el,
      start: "top 100%"
      // uncomment the next line if you want the animation to reverse when scrolling backwards. Or set scrub: true to have it sync with the scrollbar position
      // toggleActions: "play none none reverse"
    }
  });
});

/* To Do:
    - Reverse the SplitLines once animation is completed. 
    - Reverse, SplitLines again and animate once window is resized.
 */

              
            
!
999px

Console