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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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>

<section class="item item-3">
    <div class="wrap">
        <div class="align align-left active">
            <span class="line line-1"></span>
            <span class="line line-2"></span>
            <span class="square square-1"></span>
            <span class="square square-2"></span>
        </div>
        <div class="align align-center">
            <span class="line line-1"></span>
            <span class="line line-2"></span>
            <span class="square square-1"></span>
            <span class="square square-2"></span>
        </div>
        <div class="align align-right">
            <span class="line line-1"></span>
            <span class="line line-2"></span>
            <span class="square square-1"></span>
            <span class="square square-2"></span>
        </div>
        <div class="align align-bar">
                <span class="line line-1"></span>
                <span class="line line-2"></span>
                <span class="square square-1"></span>
                <span class="square square-2"></span>
            </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%;}
		}
	}
}

// FOR #3
.item-3 {
	width: 100%;
	background: #E2EAF4;
	&:before {content: '#3'}
	.wrap {
		background: #fff;
		border-radius: 20px;
		padding: 27px 35px;
		width: 228px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: relative;
		box-shadow: 0px 20px 61px -14px rgba(0,0,0,0.2);
	}
	.align {
		display: inline-block;
		position: relative;
		width: 40px;
		height: 30px;
		cursor: pointer;
		span {
			background: #BFCCD7;
			display: inline-block;
			position: absolute;
			top: 0;
			left: 0;
		}
		.line {
			width: 2px;
			height: 30px;
		}
		.square {
			width: 8px;
			height: 20px;
			top: 50%;
			transform: translateY(-50%);
			&-2 {height: 12px;}
		}
		&-left {
			.line-2 {left: 14px;}
			.square-2 {left: 14px;}
		}
		&-center {	
			left: 4px;
			.line-1 {left: 3px;}
			.square-1 {left: 0px;}
			.line-2 {left: 17px;}
			.square-2 {left: 14px;}
		}
		&-right {
			.line-1 {left: 13px;}
			.square-1 {left: 7px;}
			.line-2 {left: 27px;}
			.square-2 {left: 21px;}
		}
		&-bar {
			position: absolute;
			top: 27px;
			left: 35px;
			width: 100%;
			opacity: 0;
			margin-right: 0;
			pointer-events: none;
			margin: 0;
			span {background: #1C8BFD;}
		}
	}
}


.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');
    });
	
	// FOR #3
    $('.item-3 .align-bar').css('opacity', 1);
    $('.item-3 .align-bar span.line-1').css('left', $('.item-3 .align.active span.line-1').position().left);
    $('.item-3 .align-bar span.line-2').css('left', $('.item-3 .align.active span.line-2').position().left);
    $('.item-3 .align-bar span.square-1').css('left', $('.item-3 .align.active span.square-1').position().left);
    $('.item-3 .align-bar span.square-2').css('left', $('.item-3 .align.active span.square-2').position().left);

    $('.item-3 .align').click(function() {
        $('.item-3 .align-bar span.line-1').animate({
            left: $(this).find('span.line-1').position().left
        });
        $('.item-3 .align-bar span.line-2').animate({
            left: $(this).find('span.line-2').position().left
        });
        $('.item-3 .align-bar span.square-1').animate({
            left: $(this).find('span.square-1').position().left
        });
        $('.item-3 .align-bar span.square-2').animate({
            left: $(this).find('span.square-2').position().left
        });

        $('.item-3 .align-bar').animate({
            left: $(this).position().left
        });
    });
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console