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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              .book
	.page-left
	.page-right
	ul.rings
		- for (i = 0; i < 13; i++)
			li
				span

p Amazing drawings by 
	a(href="https://www.deviantart.com/kuvshinov-ilya" target="_blank") Kuvshinov Ilya
            
          
!
            
              // Import a font
@import url('https://fonts.googleapis.com/css?family=Sunflower:300')

*
	box-sizing border-box

poscenter(m=50%, n=m, tf=)
	position absolute
	left m
	top n
	transform translate(-@left, -@top) tf

body
	background #2f2f31
	min-height 100vh
	color #f
	perspective 600px
	overflow hidden

.book
	poscenter(,,rotateX(4deg) translateY(-3%))
	width 80%
	height 90vh
	max-height 768px

	&::before
	&::after
		content ""
		poscenter()
		width 1rem
		height 100%
		left calc(50% - .5rem)
		background-color #08
		z-index -1
	&::before
		border-top-right-radius 16px 6px
		border-bottom-right-radius 16px 6px

	&::after
		left calc(50% + .5rem)
		border-top-left-radius 16px 6px
		border-bottom-left-radius 16px 6px

.book div // pages
	background-color #b5
	width 50%
	height 100%
	position absolute
	top 0
	right calc(50% + .5rem)
	overflow auto

	& + div
		right auto
		left calc(50% + .5rem)

ul
	height 90%
	width 3rem
	poscenter()
	display flex
	flex-direction column
	
	li
		height 100%
		position relative

		&::before
		&::after
			content ""
			width 6px
			height 8px
			border-radius 25%
			poscenter(1%, 50%)
			background-color black
			z-index -5
		&::after
			poscenter(99%, 50%)

		span
			border-radius 50%
			width: 3rem
			poscenter()
			border-style solid
			border-color grey transparent transparent transparent
			border-width 5px 4px 0 4px
			z-index 5
	li:nth-of-type(n+7)
		transform rotate(180deg)

	for i in 1..13
		li:nth-of-type({i})::before
		li:nth-of-type({i})::after
			
			top calc(50% - size)
		li:nth-of-type({i}) span
			height abs(-18px+i*2)


.page-left
	text-align center
	padding 2.5%
	overflow auto

	img
		max-width 20%
		min-width  48px
		max-height 200px
		width auto
		height auto
		background-color #f
		padding .5rem
		margin .5rem
		display inline-block
		transition 1.5s

		&.active
		&:hover
			transform scale(1.04)
			box-shadow 0 4px 16px #0003

.page-right img
	poscenter()
	max-width 85%
	max-height 85%
	opacity 0
	transition .8s, opacity .45s .15s
	filter blur(32px)
	background-color #f
	padding 1rem

	&.active
		filter blur(0px)
		opacity 1



p
	poscenter(50%,99%)
	color #576
	font-family Sunflower
	font-size 0.8rem

	a
		color #697
            
          
!
            
              let sources = [
	'https://orig00.deviantart.net/1dfd/f/2018/263/1/f/doro_by_kuvshinov_ilya-dcnbgw3.jpg',
	'https://orig00.deviantart.net/edd6/f/2018/170/3/5/depth_of_field_by_kuvshinov_ilya-dcetf0p.jpg',
	'https://orig00.deviantart.net/91c3/f/2018/170/1/9/boushi_by_kuvshinov_ilya-dcetfrj.jpg',
	'https://orig00.deviantart.net/1cf2/f/2018/263/6/7/uesaka_sumire_album_cover_illustration_by_kuvshinov_ilya-dcnbfu8.jpg',
	'https://orig00.deviantart.net/1dc6/f/2018/170/3/0/earring_by_kuvshinov_ilya-dceteuz.jpg',
	'https://orig00.deviantart.net/3171/f/2018/170/0/5/hayashi_by_kuvshinov_ilya-dcetah7.jpg',
	'https://orig00.deviantart.net/dc3b/f/2018/170/7/f/rose_by_kuvshinov_ilya-dcetaqj.jpg',
	'https://img00.deviantart.net/e978/i/2018/170/0/f/sanpo_by_kuvshinov_ilya-dceta26.jpg',
	'https://orig00.deviantart.net/bf7b/f/2018/170/9/2/my_artwork_collection_momentary_reprinted_by_kuvshinov_ilya-dcetaxx.jpg',
	'https://orig00.deviantart.net/9f20/f/2018/050/2/b/twin_tails_by_kuvshinov_ilya-dc3q77o.jpg'
]

let imgTag,
	clonedTag

for (let i = 0; i < sources.length; i++) {
	imgTag = document.createElement('img')
	imgTag.src = sources[i]
	if (i == 0) imgTag.classList.add('active')
	clonedTag = imgTag.cloneNode(true)
	document.querySelector('.page-left').appendChild(imgTag)
	document.querySelector('.page-right').appendChild(clonedTag)
}

const imgs = document.querySelectorAll('.page-left img')
let orig,
	curr

for (let i = 0; i < imgs.length; i++) {
	imgs[i].addEventListener('click', function () {
		if (this.classList.contains('active')) return false

		orig = Array.prototype.indexOf.call(imgs, document.querySelector('.page-left img.active'))
		curr = Array.prototype.indexOf.call(imgs, this)

		document.querySelector('.page-left img.active').classList.remove('active')
		this.classList.add('active')
		
		document.querySelectorAll('.page-left img')[orig].classList.remove('active')
		document.querySelectorAll('.page-right img')[orig].classList.remove('active')
		document.querySelectorAll('.page-left img')[curr].classList.add('active')
		document.querySelectorAll('.page-right img')[curr].classList.add('active')

		return false
	})
}

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

Console