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.

            
              <body>
		<div class="section s-header">
			<div class="container c-header">
        <h1>Button Animations with Velocity.js</h1>
			</div>
		</div>
		<div class="section s-one">
			<div class="container">
				<div class="button b-one">
					<h2>Rise on Hover</h2>
				</div>
			</div>
		</div>
		<div class="section s-two">
			<div class="container">
				<div class="button b-two">
					<h2>Bounce on Click</h2>
				</div>
			</div>
		</div>
		<div class="section s-three">
			<div class="container">
				<div class="button b-three">
					<h2>Pop on Click</h2>
				</div>
			</div>
		</div>
		<div class="section s-four">
			<div class="container">
				<div class="button b-four">
					<h2>Shake on Click</h2>
				</div>
			</div>
		</div>
		<div class="section s-five">
			<div class="container">
				<div class="button b-five glow">
					<h2>Glow On/Off</h2>
				</div>
			</div>
		</div>
		<script src="jquery-2.1.1.js"></script>
		<script src="jquery-ui.min.js"></script>
		<script src="velocity.min.js"></script>
		<script src="button-animations.js"></script>
	</body>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Raleway:800,400);

body {
	top: 0;
	left: 0;
	margin: 0;
}

h1 {
  font-family: 'Raleway', Helvetica, sans-serif;
	font-size: 4rem;
	font-weight: 800;
	color: #fff;
}

h2 {
	font-family: 'Raleway', Helvetica, sans-serif;
	font-size: 1.3rem;
	font-weight: 400;
}

.section,
.container,
.button {
	display: flex;
	justify-content: center;
	align-items: center;
}

.section {
	position: relative;
	height: 500px;
	width: 100%;
	margin: 0;
}

.container {
	position: relative;
	height: 200px;
	width: 80%;
	margin: 0 auto;
}

.button {
	position: relative;
	background-color: #FFC107;
	height: 80px;
	width: 240px;
	border-radius: 40px;
	margin: 0 auto;
	cursor: pointer;
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
}

.s-header,
.s-three {
	background: #03A9F4;
}

.s-one,
.s-four {
	background: #B3E5FC;
}

.s-two,
.s-five {
	background: #0288D1;
}

.c-header {
	text-align: center;
	color: #fff;
}

.b-one,
.b-two,
.b-three,
.b-four,
.b-five {
	color: #fff;
}

.b-two {
	-webkit-transform-origin: 100% 100%;
	transform-origin: 100% 100%;
}

.glow {
	box-shadow: #d5a310 0 0 10px 10px;
}
            
          
!
            
              $(".c-header").velocity("fadeIn", 1000)

$(".b-one").mouseenter(function(){
	$(this)
		.velocity( { translateY: "-10px", backgroundColor: "#FFEB3B" }, 400 );
});

$(".b-one").mouseleave(function(){
	$(this)
		.velocity( { translateY: "0", backgroundColor: "#FFC107" }, 200 );
});

$(".b-two").mousedown(function(){
	$(this)
		.velocity({ translateY: "-30px", rotateZ: "10deg" }, 100, "easeOut")
		.velocity({ rotateZ: "-8deg" }, 150)
		.velocity({ translateY: "0", rotateZ: "0" }, {duration: 600, easing: [ 500, 14 ]});
});

$(".b-three").mousedown(function(){
	$(this)
	.velocity({ scale: "1.5"}, 150, "easeInOut")
	.velocity("reverse");
});

$(".b-four").mousedown(function(){
	$(this).effect("shake");
})

$(".b-five").removeClass("glow");

$( ".b-five" ).click(function() {
	$(this)
		.toggleClass( "glow", 2000, "easeOutSine" );
});
            
          
!
999px
Loading ..................

Console