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

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.

HTML

              
                <article>
  <p><strong>Hey girl</strong></p>
  <p>Hey girl, I brought home a few bottles of wine since I know you needed more corks for that pinterest project. Then, telling Derek Cianfrance that I'd ever I could rob a bank I'd do it on my motorcycle, and he said 'That's weird, I just wrote a script
    about that'. I drive. I wrote you 365 letters. I wrote you everyday for a year.</p>

  <p>I drive. Anything happens a minute either side of that, and you're on your own. I think like a girl, I think. Anything happens in that five minutes, then I'm yours, no matter what. I don't sit in while you're running it down.</p>

  <p><strong>I love being Canadian</strong></p>
  <p>I love being Canadian. I think growing up in Canada gives you a world perspective that I certainly enjoy. I think like a girl, I think. I hear about actors who become the role and I think 'I wonder what that feels like'. We're always changing. In most
    movies you spend so much time looking for any scraps of truth, and in this movie you're just marinating in it.</p>

  <p>Anything happens in that five minutes and I'm yours. You tell me where we start, where we're going, where we're going afterwards. Then, telling Derek Cianfrance that I'd ever I could rob a bank I'd do it on my motorcycle, and he said 'That's weird, I
    just wrote a script about that'. I hear about actors who become the role and I think 'I wonder what that feels like'. You have a shelf life as an actor, so you have to find another way to express yourself.</p>

  <p><strong>I wrote you 365 letters</strong></p>
  <p>I wrote you 365 letters. Anything by Disney makes me cry. I could be pensive, uhh... smart, supersticious, brave? And I, uhh, I can be light on my feet. I went through puberty in a theme park. You just tell me what you want, and I'm gonna be that for
    you.
  </p>

  <p>You just have to hang out in places that are more interesting than you are. I love being Canadian. I think growing up in Canada gives you a world perspective that I certainly enjoy. You tell me where we start, where we're going, where we're going afterwards.
    I could be pensive, uhh... smart, supersticious, brave? And I, uhh, I can be light on my feet. I won't eat my cereal.</p>

  <p><strong>I could be whatever you want</strong></p>
  <p>I could be whatever you want. I try not to make too many movies. Anything happens in that five minutes and I'm yours. It just felt meant to be. There would be no cuts, real people in there, real tellers.</p>

  <p>I don't know enough about manliness to define it. If ever I try to predict, I'm sure I will be instantly humbled. My character seems to think that he is, so he would define it. I think the one thing I love most about being an adult is the right to buy
    candy whenever and wherever I want. But everytime that happens, what do you get? You get a new day.</p>

  <p><strong>I wrote you everyday for a year</strong></p>
  <p>I wrote you everyday for a year. I'm really not good at knowing what people want, because don't have that talent. I get sick of myself, so I can imagine how everyone else feels. I'm not a good enough actor to become a character. I want all of you, forever,
    everyday. You and me...everyday.</p>

  <p>I don't carry a gun. I think the one thing I love most about being an adult is the right to buy candy whenever and wherever I want. But everytime that happens, what do you get? You get a new day. I love being Canadian. I think growing up in Canada gives
    you a world perspective that I certainly enjoy. It feels like not that long ago that I was on a show called 'Young Hercules' in which I had a fake tan and wore tight leather pants and fought imaginary monsters.</p>

  <p><strong>You have a shelf life as an actor</strong></p>
  <p>You have a shelf life as an actor, so you have to find another way to express yourself. Anything happens in that five minutes and I'm yours. I think the one thing I love most about being an adult is the right to buy candy whenever and wherever I want.
    If ever I try to predict, I'm sure I will be instantly humbled. I won't eat my cereal.</p>

</article>

<img class="rygo" src="https://pngimage.net/wp-content/uploads/2018/06/ryan-gosling-png-4.png" alt="">
              
            
!

CSS

              
                .rygo {
  bottom: -500px;
  position: fixed;
  right: 0;
  width: 500px;
}
              
            
!

JS

              
                const rygo = document.querySelector(".rygo");
const rygoStylin = window.getComputedStyle(rygo);
const startPos = parseInt(rygoStylin.getPropertyValue("bottom"), 10);
const stopPos = 0;

const rygoDance = () => {
  let scrollPercent =
    window.pageYOffset /
    (document.documentElement.scrollHeight -
      document.documentElement.clientHeight) *
    100;
  let scrollPos = scrollPercent * (stopPos - startPos) / 100 + startPos;

  rygo.style.bottom = `${scrollPos}px`;
};

window.addEventListener("scroll", rygoDance, false);

              
            
!
999px

Console