<div class="content">
    <div class="fix">
      <button onclick="this.parentElement.classList.toggle('right')">Jump</button>
    </div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
End of the content
  </div>
.content {
  position: relative;
  width: 300px;
  background: red;
}

.fix {
  position: fixed;
  background: green;
  padding: 10px 0;
}

.fix.right {
  right: 0;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.