Vintage Book Tutorial
<!-- VINTAGE MINI BOOK -->
<div class="vintageBook">
<!-- BOOK -->
<div class="book">
<!-- COVER -->
<div class="bookCover" onclick="openVintageBook()">
<div class="coverInner">
<div class="ornament">✦</div>
<div class="coverTitle">
MY<br />
LITTLE<br />
BOOK
</div>
<div class="coverLine"></div>
<div class="coverSubtitle">
a vintage story
</div>
<div class="ornament bottom">✦</div>
</div>
</div>
<!-- PAGES / FLIPBOOK -->
<div class="bookPages">
<iframe
src="https://online.flippingbook.com/view/1006906254/"
allowfullscreen
loading="lazy">
</iframe>
</div>
</div>
<!-- CLOSE BUTTON -->
<button
class="closeBook"
onclick="closeVintageBook()"
aria-label="Close book">
×
</button>
</div>
<style>
/* =========================================
BOOK CONTAINER
========================================= */
.vintageBook{
width:190px;
margin:15px auto;
position:relative;
perspective:1200px;
font-family:Georgia, "Times New Roman", serif;
box-sizing:border-box;
overflow:visible;
display:flex;
justify-content:center;
}
/* =========================================
CLOSED BOOK
========================================= */
.book{
width:190px;
height:250px;
position:relative;
transform-style:preserve-3d;
box-sizing:border-box;
overflow:visible;
margin:0 auto;
transition:
width .7s ease,
height .7s ease;
}
/* =========================================
PAGES
========================================= */
.bookPages{
position:absolute;
inset:0;
background:#eee4d4;
border-radius:
7px 10px 10px 7px;
overflow:hidden;
box-shadow:
2px 3px 8px rgba(0,0,0,.28),
inset 5px 0 0 rgba(90,60,40,.08);
}
/* =========================================
FLIPBOOK
========================================= */
.bookPages iframe{
width:100%;
height:100%;
border:0;
display:block;
margin:0;
padding:0;
}
/* =========================================
COVER
========================================= */
.bookCover{
position:absolute;
inset:0;
z-index:5;
cursor:pointer;
background:
linear-gradient(
135deg,
#5b1e2c,
#72283b 45%,
#4b1724
);
border-radius:
6px 11px 11px 6px;
box-shadow:
3px 5px 12px rgba(0,0,0,.38),
inset -4px 0 0 rgba(0,0,0,.15),
inset 2px 0 0 rgba(255,255,255,.08);
transform-origin:left center;
transform-style:preserve-3d;
transition:
transform 1.1s cubic-bezier(.65,.05,.35,1),
box-shadow .5s;
}
/* =========================================
OPEN COVER
========================================= */
.vintageBook.open .bookCover{
transform:rotateY(-150deg);
box-shadow:
-5px 4px 12px rgba(0,0,0,.15);
}
/* =========================================
OPEN BOOK
========================================= */
.vintageBook.open{
width:650px;
margin-left:auto;
margin-right:auto;
justify-content:center;
}
.vintageBook.open .book{
width:650px;
height:560px;
margin-left:auto;
margin-right:auto;
}
/* =========================================
INNER COVER
========================================= */
.coverInner{
position:absolute;
inset:9px;
border:
1px solid rgba(230,205,170,.55);
border-radius:
4px 8px 8px 4px;
display:flex;
flex-direction:column;
align-items:center;
justify-content:center;
color:#f5ead7;
box-shadow:
inset 0 0 20px rgba(0,0,0,.15);
}
/* =========================================
ORNAMENTS
========================================= */
.ornament{
font-size:16px;
opacity:.9;
margin-bottom:9px;
}
.ornament.bottom{
margin-top:10px;
margin-bottom:0;
}
/* =========================================
TITLE
========================================= */
.coverTitle{
text-align:center;
font-size:20px;
line-height:1.15;
letter-spacing:2px;
text-shadow:
1px 1px 2px rgba(0,0,0,.4);
}
/* =========================================
DECORATIVE LINE
========================================= */
.coverLine{
width:65px;
height:1px;
background:#dfc5a4;
margin:11px 0 8px;
opacity:.8;
}
/* =========================================
SUBTITLE
========================================= */
.coverSubtitle{
font-size:9px;
font-style:italic;
letter-spacing:1px;
opacity:.9;
}
/* =========================================
PAGE EFFECT
========================================= */
.bookPages:before{
content:"";
position:absolute;
z-index:2;
left:3px;
top:5px;
bottom:5px;
width:3px;
background:
repeating-linear-gradient(
to bottom,
rgba(100,75,50,.18) 0px,
rgba(100,75,50,.18) 1px,
transparent 2px,
transparent 4px
);
pointer-events:none;
}
/* =========================================
CLOSE BUTTON
TOP CENTERED
========================================= */
.closeBook{
display:none;
position:absolute;
/* CENTERED */
left:50%;
transform:translateX(-50%);
/* TOP POSITION */
top:-38px;
width:30px;
height:30px;
padding:0;
border:0;
border-radius:50%;
background:#5b1e2c;
color:#fff;
font-family:Georgia,serif;
font-size:22px;
line-height:30px;
text-align:center;
cursor:pointer;
z-index:99999;
box-shadow:
0 2px 7px rgba(0,0,0,.3);
}
.vintageBook.open .closeBook{
display:block;
}
/* =========================================
HOVER EFFECT
========================================= */
.bookCover:hover{
box-shadow:
4px 6px 14px rgba(0,0,0,.42),
inset -4px 0 0 rgba(0,0,0,.15);
}
.closeBook:hover{
transform:translateX(-50%) scale(1.08);
}
/* =========================================
MOBILE
========================================= */
@media(max-width:600px){
.vintageBook{
width:170px;
margin-left:auto;
margin-right:auto;
}
.book{
width:170px;
height:225px;
}
.coverTitle{
font-size:18px;
}
/* OPEN BOOK */
.vintageBook.open{
width:82vw;
margin-left:auto;
margin-right:auto;
justify-content:center;
}
.vintageBook.open .book{
width:82vw;
height:62vh;
margin-left:auto;
margin-right:auto;
}
/* TOP CENTERED CLOSE BUTTON */
.closeBook{
left:50%;
top:-35px;
width:28px;
height:28px;
font-size:20px;
line-height:28px;
}
}
/* =========================================
SMALL PHONES
========================================= */
@media(max-width:380px){
.vintageBook.open{
width:84vw;
}
.vintageBook.open .book{
width:84vw;
height:60vh;
}
.closeBook{
left:50%;
top:-34px;
}
}
</style>
<script>
function openVintageBook(){
document
.querySelector('.vintageBook')
.classList.add('open');
}
function closeVintageBook(){
document
.querySelector('.vintageBook')
.classList.remove('open');
}
</script>

Nenhum comentário:
Postar um comentário