Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <div class="hero is-fullheight is-fullwidth has-text-center height pattern">
  <div class="hero-body">
    <div class="container">
      <div class="columns is-fullwidth is-centered">
        <div class="column is-narrow">
          <div class="flip-container center" id="flip-toggle" ontouchstart="this.classList.toggle('hover');">
            <div class="flipper">
              <div class="front">
                <!-- front content -->
                <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1668648/Take-a-Qoute_back.png" width="320px" height="480px" alt="card back" />
              </div>
              <div class="back">
                <!-- back content -->
                <img id="card" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1668648/Take-a-Qoute_1.png" width="320px" height="480px" alt="random design quote" />
              </div>
            </div>
          </div>
          <div class="section">
            <button onclick="document.querySelector('#flip-toggle').classList.toggle('hover');" class="button is-fullwidth has-text-weight-bold" id="myCard">
              Take a Quote
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                /* 
entire container, keeps perspective 
Flip CSS
*/
.flip-container {
  perspective: 1000px;
  margin: 0 auto;
}
/* flip the pane when hovered */

.flip-container:hover .flipper,
.flip-container.hover .flipper,
.flip-container.flip .flipper {
  transform: rotateY(180deg);
}

.flip-container,
.front,
.back {
  width: 320px;
  height: 434px;
}

/* flip speed goes here */
.flipper {
  transition: 0.6s;
  transform-style: preserve-3d;

  position: relative;
}

/* hide back of pane during swap */
.front,
.back {
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 25px;
}

/* front pane, placed above back */
.front {
  z-index: 2;
  /* for firefox 31 */
  transform: rotateY(0deg);
  border-radius: 25px;
  overflow: hidden;
}

/* back, initially hidden pane */
.back {
  transform: rotateY(180deg);
  border-radius: 30px;
  overflow: hidden;
}

/*
End Flip CSS
*/

.pattern {
  /* 	
  background-image:url(../images/images/asanoha-400px_transparent.png);
	background-size:120px;
	background-repeat:repeat; 
*/
  background-color: #9ec1e0;
}

              
            
!

JS

              
                // grab a random card

$(document).ready(function () {
  //flag set code I gave last night
  $("#myCard")[0].data("flipped", false);
});

$("#myCard").click(function () {
  var num = Math.random() * 54;
  num = Math.floor(num);
  num += 1;
  // console.log(num);

  if (!$("#myCard").data("flipped")) {
    // console.log("true");
    $("#myCard").data("flipped", true);
    getImage(num);
  } else {
    // console.log("False");
    $("#myCard").data("flipped", false);
  }
});

function getImage(num) {
  var path =
    "https://s3-us-west-2.amazonaws.com/s.cdpn.io/1668648/Take-a-Qoute_" +
    num +
    ".png";
  $("#card")[0].src = path;
  // console.log(path);
}

// end random card

              
            
!
999px

Console