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 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.

Quick-add: + add another resource

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.

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.

            
              
<section class="item item-1">
    <div class="wrap">
        <div class="align align__left align-active">
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div class="align align__center">
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div class="align align__right">
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div class="align align__justify">
            <span></span>
            <span></span>
            <span></span>
        </div>
        <div class="align align-bar">
            <span></span>
            <span></span>
            <span></span>
        </div>
    </div>
</section>

<section class="item item-2">
    <div class="wrap">
        <div class="align align-compound">
            <img src="https://alikinvv.github.io/alignment-buttons/build/img/i1.svg" alt="">
        </div>
        <div class="align align-top">
            <img src="https://alikinvv.github.io/alignment-buttons/build/img/i2.svg" alt="">
        </div>
        <div class="align align-cross">
            <img src="https://alikinvv.github.io/alignment-buttons/build/img/i3.svg" alt="">
        </div>
        <div class="align align-exception">
            <img src="https://alikinvv.github.io/alignment-buttons/build/img/i4.svg" alt="">
        </div>
    </div>
</section>

<a href="https://github.com/alikinvv/alignment-buttons"  target="_blank" class="github"></a>
            
          
!
            
              @charset "UTF-8";

html, body {
	height: 100%;
	font-family: 'Lato', sans-serif;
}

.item {
	width: 50%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	float: left;
	position: relative;
	&:before {
		font-weight: bold;
		font-size: 35px;
		position: absolute;
		right: 25px;
		top: 15px;
		color: #333;
	}
}


// FOR #1

.item-1 {
	background: #F0F0F0;
	&:before {content: '#1'}
	.wrap {
		background: #fff;
		border-radius: 20px;
		padding: 30px 37px;
		display: inline-block;
		position: relative;
		box-shadow: 0px 20px 61px -14px rgba(0,0,0,0.2);
	}
	.align {
		display: inline-block;
		margin-right: 35px;	
		cursor: pointer;
		span {
			background: #E1E1E1;
			display: block;
			margin-bottom: 6px;
			width: 27px;
			height: 4px;
			border-radius: 10px;
			&:last-child {margin-bottom: 0;}
		}	
		&__left span:last-child {
			width: 12px;
			float: left;
		}
		&__center span:last-child {
			width: 13px;
			position: relative;
			left: 50%;
			transform: translateX(-50%);
		}
		&__right span:last-child {
			width: 13px;
			float: right;
		}
		&__justify {margin-right: 0;}
		&-bar {
			position: absolute;
			top: 30px;
			left: 0;
			width: 100%;
			opacity: 0;
			margin-right: 0;
			pointer-events: none;
			span {background: #383838;}
		}
	}
}

// FOR #2

.item-2 {
	background: #D7DDE9;
	&:before {content: '#2'}
	.wrap {
		background: #fff;
		border-radius: 20px;
		padding: 22px 37px;
		display: inline-block;
		position: relative;
		box-shadow: 0px 20px 61px -14px rgba(0,0,0,0.2);
	}
	.align {
		background: #D7DDE9;
		width: 40px;
		height: 40px;
		display: inline-block;
		margin: 0 15px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
		img {
			position: relative;
			z-index: 2;
		}
		&::before {
			content: '';
			display: block;
			position: absolute;
			background: #14D96A;
			z-index: 1;
			transition: all .3s ease-in-out;
		}
		&-compound {
			&:before {
				top: 50%;
				left: 50%;
				transform:translate(-50%,-50%);
				width: 0;
				height: 0;				
			}
			&.active:before {
				width: 100%;
				height: 100%;
			}
		}
		&-top {
			&:before {
				top: 0;
				left: 0;
				width: 0;
				height: 100%;
			}
			&.active:before {width: 100%;}
		}
		&-cross {
			&:before {
				top: 50%;
				left: 50%;
				transform:translate(-50%,-50%);
				width: 0;
				height: 0;
				border-radius: 50%;
			}
			&.active:before {
				width: 150%;
				height: 150%;
			}
		}
		&-exception {
			&:before {
				top: 0;
				left: 0;
				width: 100%;
				height: 0;
			}
			&.active:before {height: 100%;}
		}
	}
}


.github {
	width: 40px;
	height: 40px;
	background: url(http://alikinvv.github.io/github.svg) no-repeat center;
	position: fixed;
	bottom: 40px;
	right: 40px;
	animation: github 3s cubic-bezier(0.68, -0.55, 0.27, 1.55) 0s infinite;
}

@keyframes github {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.2);
	}
	100% {
		transform: scale(1);
	}
}
            
          
!
            
              
$(document).ready(function(){
	    // FOR #1

    var tl = new TimelineMax();
    var trigger = true;
    $('.item-1 .align-bar span').css('transform', 'translateX(' + $('.item-1 .align__left').position().left + 'px');
    $('.item-1 .align-bar').css('opacity', 1);
    $('.item-1 .align-bar span:last-child').css('width', $('.item-1 .align__left span:last-child').width()).css('opacity', 1);

    $('.item-1 .align').click(function() {
        var left = $(this).position().left,
            bar = $(this).find('span:last-child').width(),
            barLeft = $(this).find('span:last-child').position().left;

        trigger = false;
        if(!trigger) {
            tl.to('.item-1 .align-bar span:nth-child(1)', 0.4, {x: left, ease: Back.easeOut.config(1.3)})
            .to('.item-1 .align-bar span:nth-child(2)', 0.4, {x: left, ease: Back.easeOut.config(1.3)}, '-=0.35')
            .to('.item-1 .align-bar span:nth-child(3)', 0.4, {x: barLeft, width: bar, ease: Back.easeOut.config(1.3)}, '-=0.35')
            trigger = true;
        }
        
    });

    // FOR #2

    $('.item-2 .align').click(function() {
        $('.item-2 .align').removeClass('active');
        $(this).addClass('active');
    });
});

            
          
!
999px
Loading ..................

Console