Jump to content
Search Community

LauraS

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by LauraS

  1. I have a series of animations that I put in a timeline. I then use ScrollTrigger to "stick" my interaction near the top of the screen and run through the animations using scrub. This works perfectly on codepen, but on my webpage, the animation stops working when the scroll reaches the end of the webpage. I just want the timeline to play to the end, but have it synched up with scroll. Should I be doing something differently please?

    See the Pen QWoKYEa by lschneiderman (@lschneiderman) on CodePen

  2. I found out the reason -- I was pinning using a variable "height" to represent the height of the screen for the end property. Somehow, that didn't work. When I used

    Quote

    end: "+=600" 

    ...that worked.

  3. I want to pin something on my screen when the website first comes up and just have that pin stay in place forever, but the next elements will scroll over it. I'm completely new to ScrollTrigger -- was using ScrollMagic before -- so I'm a real newbie here. Here's what I have (below). I want #head1 to be pinned about 1/4 of the way down the screen and just stay there. What happens is, when I come to the website, #head1 is about a 1/4 of the way down the screen. When I scroll, #head1 jumps about 200px down and is unpinned. What am I doing wrong? (I have attached a codepen, but also being new to codepen, I don't know why my codepen isn't working.)

     

    html:

    <div class="screen" >
        <img class="" id="tower" src="img/tower.jpg">

        <div class="head1" id="head1">head1</div>
    </div>

     

    css:

    .screen {
        position: relative;
        width: 100%;
        height: 100vh;
        margin-top: -2px;
        clear: both;
    }

    #tower {
         width: 100%;
       position: absolute;
       left: 0;
       top: 0;
        height: auto;
    }

    .head1 {
      color: white;
      font-family: 'Roboto', sans-serif;
      font-size: 6rem;
      font-weight: 600;
      text-align: center;
    }

     

    jquery: 

    gsap.registerPlugin(ScrollTrigger);

    $(document).ready(function() {

        ScrollTrigger.create({
          trigger: "#head1",
          start: "top 200px", 
          pin: true
        });
    });

    See the Pen BapvaOp?editors=1111 by lschneiderman (@lschneiderman) on CodePen

×
×
  • Create New...