"iPhone X | CSS Only"
Bootstrap 3.0.0 Snippet by harunpehlivan

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="workspace">
<div class="bg-content"></div>
<div class="mobile-body">
<div class="top-bar">
<div class="camera"></div>
<div class="speaker"></div>
</div>
<div class="button volume-up"></div>
<div class="button volume-down"></div>
<div class="button silent"></div>
<div class="button power"></div>
<div class="layer-2"></div>
<div class="layer-1"></div>
<div class="layer-gradient-1"></div>
<div class="layer-gradient-2"></div>
</div>
<div class="gallery-content">
<div class="gallery-content__img active" data-img="http://doodling.surge.sh/assets/images/bg-1.jpg"><img src="http://doodling.surge.sh/assets/images/bg-1.jpg"></div>
<div class="gallery-content__img" data-img="http://doodling.surge.sh/assets/images/bg-2.jpg"><img src="http://doodling.surge.sh/assets/images/bg-2.jpg"></div>
<div class="gallery-content__img" data-img="http://doodling.surge.sh/assets/images/bg-3.jpg"><img src="http://doodling.surge.sh/assets/images/bg-3.jpg"></div>
<div class="gallery-content__img" data-img="http://doodling.surge.sh/assets/images/bg-4.jpg"><img src="http://doodling.surge.sh/assets/images/bg-4.jpg"></div>
<div class="gallery-content__img" data-img="http://doodling.surge.sh/assets/images/bg-5.jpg"><img src="http://doodling.surge.sh/assets/images/bg-5.jpg"></div>
<div class="gallery-content__img" data-img="http://doodling.surge.sh/assets/images/bg-6.jpg"><img src="http://doodling.surge.sh/assets/images/bg-6.jpg"></div>
<div class="gallery-content__img" data-img="http://doodling.surge.sh/assets/images/bg-7.jpg"><img src="http://doodling.surge.sh/assets/images/bg-7.jpg"></div>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
html {
font-size: 62.5%;
}
body {
background: lightgray;
font-size: 1.4rem;
ul { list-style: none; }
a {
text-decoration: none !important;
outline: none !important;
color: inherit;
}
}
*, h1, h2, h3, h4, h5, h6, p {
margin: 0;
padding: 0;
font-weight: normal;
box-sizing: border-box;
outline: none;
}
//CUSTOM CSS
.workspace {
display: flex;
height: 100vh;
justify-content: center;
align-items: center;
background-color: white;
&.active {
.gallery-content {
transform: translateY(0);
}
.mobile-body {
transform: scale(1);
opacity: 1;
box-shadow: 0 0 2rem 1rem rgba(black, .1);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
window.onload = function () {
document.querySelector('.workspace').classList.add('active')
}
const gallery = document.querySelectorAll('.gallery-content__img'),
mobileBody = document.querySelector('.mobile-body'),
bg = document.querySelector('.bg-content')
gallery.forEach(g => {
g.addEventListener('click', function () {
const imgSrc = this.dataset.img,
activeGallery = document.querySelector('.gallery-content__img.active')
activeGallery.classList.remove('active')
this.classList.add('active')
bg.style.backgroundImage = `url('${imgSrc}')`
mobileBody.style.backgroundImage = `url('${imgSrc}')`
})
})
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: