Pen Settings



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


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.


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.


                <h1>Increment Animation Issues</h1>
<p>I am working on an animation for a slider. The intent is for an element to rotate when the slider goes to the next or previous slide, with the rotation direction matching the slider direction.</p>
<p>The issue is if a user clicks again before the initial animation finishes, the box no longer rotates in a consistent 90deg and gets offset based on the progress of the animation in progress. How do I ensure the animation completes or stays with consistent 90deg rotations if a user clicks buttons during a previous animation?</p>
<p>In the actual version, the animation is tied to Slick.js "beforeChange" event to account for dots, arrows, swipes, etc.</p>

<button class="next">Next</button>
<button class="prev">Previous</button>

<div class="square"></div>


                @import url(",400&display=swap");

body {
  font-family: "Signika Negative", sans-serif;
  font-weight: 300;
  margin: 0;
  padding: 0 20px;
  text-align: center;

.square {
  margin-top: 24px;
  margin-left: auto;
  margin-right: auto;
  width: 300px;
  height: 300px;
  background: blue;



                // infinity and beyond!
// For more check out

var myIncreasingNumber = 90;

const square = document.querySelector(".square");
const btnNext = document.querySelector(".next");
const btnPrev = document.querySelector(".prev");

btnNext.addEventListener("click", () => {, 1, {
    rotation: "-=" + myIncreasingNumber

btnPrev.addEventListener("click", () => {, 1, {
    rotation: "+=" + myIncreasingNumber