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.


                <div class="card-wrapper">
  <div class="card"></div>
    <div class="button-holder">
      <div class="false-button">False</div>
      <div class="true-button">True</div>


                .card-wrapper {
  width: 100%;
  height: 100%;
  background-color: wheat;
  padding: 20px;

.card {
  width: 250px;
  height: 300px;
  background-color: white;
  margin: auto;

.button-holder {
  width: 40%;
  height: 200px;
  margin: auto;

  .false-button, .true-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid black;
    float: left;
    text-align: center;
  .true-button {
    float: right;


                 var $card = document.querySelector(".card");
  var $left = document.querySelector(".false-button");
var range = 300; //how far from the center until the rotation/scaling reach their max
var dragAnimation = new TimelineLite({paused:true});
dragAnimation.fromTo(".card", 2, {rotation:-30}, {rotation:30, ease:Linear.easeNone})
  .fromTo(".false-button", 1, {scale:3}, {scale:1, ease:Linear.easeNone}, 0)
  .fromTo(".true-button", 1, {scale:1}, {scale:3, ease:Linear.easeNone}, 1)
var returnAnimation; //we'll populate this when dragging stops - it's for animating things back to "normal" state. 

Draggable.create(".card", {
  trigger: ".card",
  type: "x",
  cursor: '-webkit-grab',
  minimumMovement: 10,
  dragClickables: true,
  onDragStart: function() {
    if (returnAnimation) { //if the user starts dragging WHILE the card is animating back to the center (after releasing), kill that animation so it doesn't interfere.
  onDrag: function() {
    var progress = (this.x + range) / (range * 2);
    if (progress < 0) {
      progress = 0;
    } else if (progress > 1) {
      progress = 1;
  onDragEnd: function() {
    returnAnimation = new TimelineLite();".card", 0.4, {rotation:0, x:0, y:0, ease:Power1.easeInOut})
      .to(".false-button, .true-button", 0.4, {scale:1, ease:Power1.easeInOut}, 0);