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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                mixin content-placeholder(letter)
	.content-placeholder
		.row
			.img(data-letter=letter)
			.img-text
		.text.text--l
		.text.text--m
		.text.text--s
		.btn
.cards-box
	.card.hide
		+content-placeholder
	.card
		+content-placeholder("T")
	.card
		+content-placeholder("M")
	.card
		+content-placeholder("K")
	.card
		+content-placeholder("G")
              
            
!

CSS

              
                body
	background: linear-gradient(45deg, #d2f2e2, #c8e9d8)
	display: flex
	align-items: center
	justify-content: center
	height: 100vh
	font-family: Helvetica
.cards-box
	position: relative
	transform: translateX(-15px)
	.card
		width: calc(12rem + 11vh)
		max-width: 40vw
		background: #f7fffd
		border-radius: 14px
		cursor: pointer
		&.hide
			visibility: hidden
			transform: translate(200px)
		&:not(.hide)
				position: absolute
				top: 0
				left: 0
				transition: all .8s cubic-bezier(.18,.98,.45,1)
				box-shadow: 0 2px 10px 0 rgba(0,0,0,.07)
				$imagesLength: 6
				@for $i from 1 to $imagesLength
					&[data-slide='#{$i}']
						$step: 20
						$scale: 1 - ($i * 0.025)
						$opacity: 1 + ($i * 0.1)
						transform: translate(($step * $i) + 100%)
						z-index: $imagesLength + $i
						opacity: $opacity
				&[data-slide='0']
						transition: all .32s cubic-bezier(.18,.98,.45,1)
				&:not([data-slide='0'])
						// width: 25%
						

.content-placeholder
	$border-radius: 10px
	$bg: #a7f4e0
	padding: 14px 18px 20px
	.row
		display: flex
		flex-flow: row nowrap
		align-items: center
		margin-bottom: calc(.8rem + 0.4vw)
		.img
			flex-shrink: 0
			position: relative
			margin-right: 20px
			background: darken($bg, 16)
			width: calc(56px + 2vw)
			height: calc(56px + 2vw)
			border-radius: 50%
			&::after
				content: attr(data-letter)
				position: absolute
				top: 50%
				left: 50%
				transform: translate(-50%, -50%)
				font-size: calc(30px + 1vw)
				font-weight: bold
				color: white
		.img-text
			background: $bg
			width: 45%
			min-width: 145px
			height: 20px
			margin-top: -20px
			border-radius: $border-radius
			&::after
				content: ""
				display: block
				width: 80%
				height: 10px
				margin-top: 30px
				background: $bg
				border-radius: $border-radius
	.text
		$height: 2vh
		$mt: 2vh
		background: $bg
		width: 90%
		height: $height
		min-height: 12px
		max-height: 14px
		border-radius: $border-radius
		&.text--m
			width: 80%
			margin-top: $mt
			height: $height
			min-height: 12px
		&.text--s
			width: 70%
			margin-top: $mt
			height: $height
			min-height: 12px
	.btn
		width: 100%
		height: 50px
		margin-top: 20px
		background-color: #11d5af
		border-radius: 40px	

			
		
              
            
!

JS

              
                window.onload = () => {
	let sliderImagesBox = document.querySelectorAll('.cards-box');
	sliderImagesBox.forEach(el => {
		let imageNodes = el.querySelectorAll('.card:not(.hide)')
		let arrIndexes = []; // Index array
		(() => {
			// The loop that added values to the arrIndexes array for the first time
			let start = 0;
			while (imageNodes.length > start) {
				arrIndexes.push(start++);
			}
		})();

		let setIndex = (arr) => {
			for(let i = 0; i < imageNodes.length; i++) {
				imageNodes[i].dataset.slide = arr[i] // Set indexes
			}
		}
		el.addEventListener('click', () => {
			arrIndexes.unshift(arrIndexes.pop());
			setIndex(arrIndexes)
		})
		setIndex(arrIndexes) // The first indexes addition
	});
};

              
            
!
999px

Console