Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ add another resource


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


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.


Save Automatically?

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.


                <section id="hero" class="hero-anim">
    <div class="container-fluid">
        <div class="row justify-content-center align-items-center">

            <div id="hero-content-01" class="col-md-8 col-lg-6 hero-content">
                <h1 class="title">Some Title <span>subtitle</span></h1>
              <p id="posLeftStart">Text column left position before <strong>scene01in</strong>: <span>0</span></p>
              <p id="posLeftEnd">Text column left position before <strong>scene01out</strong>: <span>0</span></p>
              <p><em>Why is end left position not being reset by clearProps?</em></p>
              <button id="restart">restart</button>
            </div><!-- .col -->

           <div id="hero-imgCol-01" class="d-none d-md-block col-md-4 order-md-first hero-imgCol align-self-end">
                <img class="img-fluid" alt="fpo" src="" />

        </div><!-- .row -->
    </div><!-- .container-fluid -->
</section><!-- /.hero -->


                /* give row some bg color */
  background: pink;


    // ==== Master Timeline =========
    var master = new TimelineMax({ repeat:0 });

    TweenLite.defaultEase = Power4.easeOut;
  // element references
    var $hero = $("#hero");
    var $heroRow = $hero.find(".row");
    var $heroContent01 = $hero.find("#hero-content-01");
    var $heroImg01 = $hero.find("#hero-imgCol-01");
    function scene01in() 
        var tl = new TimelineMax({id:"heroScene01in", onComplete:data});

        var heroContentLeft01inStart = $heroContent01.position().left;
        // output above
        $("#posLeftStart span").html(heroContentLeft01inStart);

        tl.set($heroContent01, {visibility:"visible", transformOrigin:"top left", force3D:true})
          .set($heroImg01, {visibility:"visible", transformOrigin:"top left", force3D:true})
        // move content in from right
        .from($heroContent01, 2.0, {left:"100%", xPercent:0, clearProps:"transform, left"})

        // move img in from right
        .from($heroImg01, 2.0, {left:"100%", xPercent:0}, "-=1.5" );
        function data()
              var heroContentLeft01inEnd = $heroContent01.position().left;

              // output above
              $("#posLeftEnd span").html(heroContentLeft01inEnd); 

        return tl;
    function scene01out() 
        var tl = new TimelineMax({id:"heroScene01out"});
        var heroContentLeft01outStart = $heroContent01.position().left;
        // output above
        $("#posLeftEnd span").html(heroContentLeft01outStart);

        // The getBoundingClientRect() method returns the size of an element and its position relative to the viewport.
        // This method returns a DOMRect object with eight properties: left, top, right, bottom, x, y, width, height.
        var heroRowLeft = $heroRow.position().left;
        // console.log("heroRowLeft = " + heroRowLeft);

        var heroContentXoffset = heroRowLeft - heroContentLeft01outStart;
        // console.log("heroContentXoffset = " + heroContentXoffset);

        // animate image out to left, then hide$heroImg01, 2.0, {xPercent:-100, left:"-10%", force3D:true, clearProps:"transform, left"})

        // re-position content to left
        .to($heroContent01, 2.0, { x:heroContentXoffset }, "-=1.5");

        return tl;
    master.add( scene01in() )
          .add( scene01out(), "+=2" ) ;