cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div id="recog" class="wrap">
  <h2>Payment details</h2>
  <p>Swipe to choose your option</p>
  <button class="btn-back">
  			<svg height="24" viewBox="0 0 24 24" width="24">
   			 <path  d="M13.5,7A6.5,6.5 0 0,1 20,13.5A6.5,6.5 0 0,1 13.5,20H10V18H13.5C16,18 18,16 18,13.5C18,11 16,9 13.5,9H7.83L10.91,12.09L9.5,13.5L4,8L9.5,2.5L10.92,3.91L7.83,7H13.5M6,18H8V20H6V18Z" />
		</svg>
   
  		</button>
  <div class="cr-wrap">
    <div class="card pattern"></div>
    <!--pattern card-->
    <div class="card pattern">
      <div>
        <h3>Can't find your option ?</h3>
        <p>Contact us or you may Swipe back to the available option</p>
      </div>
    </div>
    <!--pattern card -->
    <div class="card item" data-order="4"><img src="http://citylightspress.com/ims/skrill.svg"></div>
    <div class="card item" data-order="3"><img src="http://citylightspress.com/ims/mc.svg"></div>
    <div class="card item" data-order="2"><img src="http://citylightspress.com/ims/paypal.svg"></div>
    <div class="card item active" data-order="1"><img src="http://citylightspress.com/ims/visa.svg"></div>


    <!-- Indicators -->
    <ul class="indicators">
      <li class="active"></li>
      <li></li>
      <li></li>
      <li>
        <a href="#slide-4"></a>
      </li>
    </ul>

  </div>
  <!-- end of cr-wrap -->
  <div class="details">
    <form id="form">
      <div class="inputswrap">
        <div class="form-group">
          <input type="text" id="name">
          <label for="name">Name</label>
        </div>

        <div class="form-group inline">
          <input type="number" id="credit">
          <label for="credit">Credit Number</label>
        </div>
        <div class="form-group inline">
          <div class="two-third">
            <input type="number" id="exp-date">
            <label for="exp-date">Expire Date</label>
          </div>
          <div class="third">
            <input type="number" id="cvv">
            <label for="ccv">CVV</label>
          </div>
        </div>

      </div>
      <!-- InputsWrap end -->

      <button class="form-btn" type="submit"><span>Complete order</span>
				<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
					<path d="M0 0h24v24H0z" fill="none"/>
					<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
				</svg>
		</button>
    </form>
  </div>

</div>
            
          
!
            
              $blue: #3f8edd;
$third: (960px / 3);
input:focus {
	box-shadow: none;
	outline: none;
}

input[type=number] {
	-moz-appearance: textfield;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

body {
	background: #17689C;
	font-family: 'Roboto', sans-serif;
	font-size: 14px;
}

h2 {
	font-size: 24px;
	font-weight: 300;
}

img {
	user-drag: none;
	user-select: none;
}

.wrap {
	background: $blue;
	width: $third;
	margin: 30px auto 0;
	padding-top: 50px;
	height: 500px;
	text-align: center;
	position: relative;
	color: #fff;
	border-radius: 4px;
	box-shadow: 0 19px 38px rgba(0, 0, 0, 0.30), 0 15px 12px rgba(0, 0, 0, 0.22);
	transition: all 0.5s ease;
	overflow: hidden;
	& h2 {
	margin: 0 0 5px 0;
	}
	& p {
	margin: 0 0 25px 0;
	}
	&.frm {
		padding-top: 0;
		transition: all 0.5s ease;
		& .card:not(.shrink) {
			display: none;
		}
	}
}


.btn-back {
	visibility: hidden;
	position: absolute;
	left: -40px;
	top: 3px;
	width: 36px;
	height: 36px;
	background: transparent;
	box-shadow: none;
	border: none;
	padding: 0;
	z-index: 6;
	cursor: pointer;
	transition: all 0.5s cubic-bezier(.87, -.41, .19, 1.44);
	& svg {
		fill: $blue;
	}
	&.show {
		visibility: visible;
		left: 3px;
		transition-delay: 0.4s;
	}
}

.cr-wrap {
	position: relative;
	max-height: 100%;
	perspective: 800px;
	perspective-origin: top;
}

.card {
	background: white;
	border-radius: 6px;
	width: ($third - 50px);
	margin: 0 auto 15px;
	height: 140px;
	display: flex;
	top: 0px;
	left: 0;
	right: 0;
	transition: all 0.5s;
	justify-content: center;
	position: relative;
	@for $i from 0 through 10 {
		&:nth-of-type(#{$i}) {
			margin-top: ( $i * 5px);
			@if $i==2 {
				width: ($third - 40px);
				position: absolute;
				box-shadow: 0 4px 20px rgba(0, 0, 0, 0.19), 0 2px 6px rgba(0, 0, 0, 0.23);
				animation-timing-function: cubic-bezier(.87, -.41, .19, 1.44);
			}
		}
	}
	&.item {
		width: ($third - 30px);
		margin-top: 0;
		position: absolute;
		top: 20px;
		transform: translateZ(-100px) translateX(0);
		visibility: hidden;
		z-index: 5;
		transition-timing-function: ease;
	}
	& img {
		width: (100% / 2.5);
		height: auto;
	}
	&.active {
		box-shadow: 0 4px 20px rgba(0, 0, 0, 0.19), 0 2px 6px rgba(0, 0, 0, 0.23);
		transform: translateZ(0) translateX(0);
		cursor: pointer;
		visibility: visible;
		z-index: 6;
	}
	&.paned {
		overflow: hidden;
		box-shadow: none;
		transform: translateZ(0) translateX(-500px);
		visibility: visible;
	}
	&.shrink {
		width: 100%;
		top: 0;
		position: relative;
		border-radius: 0;
		box-shadow: none;
		visibility: visible;
		z-index: 6;
		transform: translateZ(0);
		transition: all 0.6s cubic-bezier(0, 1.83, .71, -0.53);
	}
}

.indicators {
	margin: 170px 0 0;
	padding: 0;
	transition: all 0.6s ease-in-out;
	& li {
		border-radius: 50%;
		background: $blue - 25;
		width: 10px;
		height: 10px;
		display: inline-block;
		list-style: none;
		&.active {
			background: #fff;
		}
	}
}


/* Other Form */

.frm {
	& .cr-wrap {
		top: 0;
	}
	& h2,
	p,
	.indicators {
		display: none;
	}
}

.details {
	height: 0;
	visibility: hidden;
	&.active {
		height: auto;
		visibility: visible;
	}
}

form {
	margin: 0 10px;
}

.inputswrap {
	width: 5%;
	visibility: hidden;
	margin: 0 auto;
}

.form-group {
	margin-bottom: 1px;
	position: relative;
	width: 100%;
	display: flex;
	&.inline .two-third:first-of-type {
		padding-left: 0;
		width: 70%;
		position: relative;
		padding-right: 1px;
	}
	&.inline .third:last-of-type {
		padding-right: 0;
		width: 30%;
		position: relative;
	}
	& textarea {
		width: 100%;
		height: 160px;
		color: #fff;
		background: #4ea0f4;
		border: none;
		&.active + label {
			opacity: 0;
		}
	}
	& input {
		width: 100%;
		height: 50px;
		line-height: 40px;
		border: none;
		padding-left: 10px;
		color: #fff;
		background: #4ea0f4;
		box-sizing: border-box;
		&.active + label {
			opacity: 0;
		}
	}
	& label {
		color: #fff;
		position: absolute;
		left: 10px;
		font-size: 12px;
		top: 15px;
		text-transform: uppercase;
	}
}

.form-btn {
	position: absolute;
	width: 100%;
	bottom: -50px;
	left: 0;
	border: none;
	height: 10%;
	padding: 10px 0;
	color: #fff;
	border-radius: 0;
	font-size: 14px;
	background: #2ee940;
	z-index: 7;
	& svg {
		visibility: hidden;
		height: 0;
		width: 0;
		fill: white;
	}
	&.act {
		height: 100%;
		bottom: 0;
		transition: all 0.6s cubic-bezier(.87, -.41, .19, 1.44);
		& span {
			visibility: hidden;
		}
		& svg {
			visibility: visible;
			height: 48px;
			width: 48px;
			margin: 0 auto;
			position: inherit;
			left: 0;
			right: 0;
			top: 40%;
		}
	}
}

.frm .inputswrap {
	width: 100%;
	visibility: visible;
	transition: all 0.6s cubic-bezier(.87, -.41, .19, 1.44);
	transition-delay: 0.2s;
	& + .form-btn:not(.act) {
		bottom: 0;
		transition: all 0.3s cubic-bezier(.87, -.41, .19, 1.44);
		transition-delay: 0.6s;
	}
}

@keyframes pulse {
	from {
		transform: scale3d(1.05, 1.05, 1.05);
	}
	to {
		transform: scale3d(1, 1, 1);
	}
}

.pulse {
	animation-name: pulse;
	animation-duration: 0.2s;
}
            
          
!
            
              // View it on Chrome
var wrap = document.getElementById('recog')
var mc = new Hammer(wrap)

var animateCss = function(animationName, animationElem) {
  animationElem.classList.add(animationName)
  animationElem.addEventListener('animationend', function() {
    animationElem.classList.remove(animationName);
  })
}

var items = document.querySelectorAll('.item')
var bullets = wrap.querySelector('.indicators')
var patterns = wrap.querySelectorAll('.pattern')

var moveForward = function() {
  var active = wrap.querySelector('.active')
  if (active != items[0]) {
    active.classList.add('paned')
    active.classList.remove('active')
    for (var i = 0; i < patterns.length; ++i) {
      animateCss('pulse', patterns[i])
    }
  }
  var prev = active.previousElementSibling
  prev && prev.matches('.item') ? prev.classList.add('active') : null
}

var moveBackward = function() {
  var paned = wrap.querySelector('.paned')
  paned.classList.add('active')
  paned.classList.remove('paned')
  var prev = paned.previousElementSibling
  prev && prev.matches('.item') ? prev.classList.remove('active') : null

  for (var i = 0; i < patterns.length; ++i) {
    animateCss('pulse', patterns[i])
  }
}

var bulletLinks = document.querySelectorAll('.indicators li')
var linksArray = Array.prototype.slice.call(bulletLinks)
var itemsSlice = Array.prototype.slice.call(items);
var itemsArray = itemsSlice.reverse();

var bulletMove = function() {
  var activeItem = document.querySelector('.item.active')
  var itemIndex = itemsArray.indexOf(activeItem);
  var activeBullet = linksArray[itemIndex]
  activeBullet.classList.add('active')
  for (var i = 0; i < linksArray.length; i++) {
    linksArray[i] != activeBullet ? linksArray[i].classList.remove('active') : null
  }
}

mc.on('swipeleft', function() {
  moveForward();
  bulletMove();
})

mc.on('swiperight', function() {
  moveBackward();
  bulletMove();

})

var details = document.querySelector('.details')
var inputWrap = document.querySelector('.inputswrap')
var btnBack = document.querySelector('.btn-back')

for (var i = 0; i < items.length; ++i) {
  items[i].addEventListener('click', function(e) {
    e.preventDefault()
    this.classList.add('shrink')
    this.classList.remove('active')
    wrap.classList.add('frm')
    details.classList.add('active')
    animateCss('pulse', this)
    animateCss('pulse', inputWrap)
    btnBack.classList.add('show')
    btnBack.addEventListener('click', function(s) {
      s.preventDefault()
      var shrink = wrap.querySelector('.shrink')
      this.classList.remove('show')
      setTimeout(function() {
        shrink.classList.remove('shrink')
        shrink.classList.add('active')
        wrap.classList.remove('frm')
        details.classList.remove('active')
      }, 800);
    })
  })
}

var form = document.getElementsByTagName("form")
for (var i = 0; i < form.length; i++) {
  form[i].addEventListener('focus', function(e) {
    e.target.classList.add('active')
  }, true)
  form[i].addEventListener('blur', function(e) {
    e.target.value != 0 ? e.target.classList.add('active') : e.target.classList.remove('active')
  }, true)
}

document.querySelector('.form-btn').addEventListener('click', function(event) {
  event.preventDefault()
  this.classList.add('act')
})
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console