devo-book/pad.html

196 lines
4.1 KiB
HTML
Raw Normal View History

2021-08-17 10:42:48 -04:00
<style>
2021-09-01 14:19:29 -04:00
2021-09-01 15:53:23 -04:00
.frame
2021-09-01 11:59:49 -04:00
{
position:relative;
width:500px;
padding:20px;
border-bottom: none;
box-sizing:border-box;
}
2021-09-01 14:19:29 -04:00
2021-09-01 15:53:23 -04:00
.frame__image
{
position:relative;
z-index:20;
margin-bottom:19px;
}
2021-09-01 14:19:29 -04:00
2021-09-01 15:53:23 -04:00
.frame__bar
2021-09-01 11:59:49 -04:00
{
position:relative;
bottom:0;
left:0;
width:100%;
2021-09-01 14:19:29 -04:00
height:44px;
2021-09-01 11:59:49 -04:00
overflow:hidden;
2021-09-01 15:53:23 -04:00
transform-origin: center 22.5px;
2021-09-01 11:59:49 -04:00
}
2021-09-01 15:53:23 -04:00
.frame__bar span
2021-09-01 11:59:49 -04:00
{
display: block;
position: absolute;
2021-09-01 14:19:29 -04:00
top: -10.5px;
2021-09-01 11:59:49 -04:00
left: 50%;
width: 20px;
2021-09-01 14:19:29 -04:00
height: 20px;
2021-09-01 11:59:49 -04:00
border: 5px solid #000;
2021-09-01 14:19:29 -04:00
border-right-color: transparent;
border-bottom-color: transparent;
2021-09-01 11:59:49 -04:00
transform: translate(-50%, 20px) rotate(45deg);
2021-09-01 14:19:29 -04:00
transition: left 0.4s;
2021-09-01 11:59:49 -04:00
}
2021-09-01 15:53:23 -04:00
.frame__bar span::before, .frame__bar span::after
2021-09-01 11:59:49 -04:00
{
2021-09-01 14:19:29 -04:00
content: " ";
2021-09-01 11:59:49 -04:00
display: block;
2021-09-01 14:19:29 -04:00
position: absolute;
width: 1000px;
height:0px;
border-top: 5px solid black;
transform:rotate(-45deg);
}
2021-09-01 15:53:23 -04:00
.frame__bar span::before
2021-09-01 14:19:29 -04:00
{
bottom: -0.5px;
right: 20px;
transform-origin: right bottom;
2021-09-01 11:59:49 -04:00
}
2021-09-01 15:53:23 -04:00
.frame__bar span::after
2021-09-01 14:19:29 -04:00
{
top: -4px;
left: 17px;
transform-origin: left top;
}
2021-09-01 15:53:23 -04:00
.frame__bar--down
2021-09-01 14:19:29 -04:00
{
transform: scaleY(-1);
}
2021-09-01 15:53:23 -04:00
.frame__bar--up
2021-09-01 14:19:29 -04:00
{
transform: scaleY(1);
}
2021-09-01 15:53:23 -04:00
.frame__bar--1-3 span
2021-09-01 14:19:29 -04:00
{
left:16.6%;
}
2021-09-01 15:53:23 -04:00
.frame__bar--2-3 span
2021-09-01 11:59:49 -04:00
{
left:50%;
}
2021-09-01 15:53:23 -04:00
.frame__bar--3-3 span
2021-09-01 11:59:49 -04:00
{
2021-09-01 14:19:29 -04:00
left:83%;
2021-09-01 11:59:49 -04:00
}
2021-09-01 14:19:29 -04:00
2021-09-01 15:53:23 -04:00
.frame__bracket
{
position:relative;
display:block;
width:100%;
height:0px;
top:-200px;
z-index:10;
border-top:5px solid black;
}
.frame__bracket::before, .frame__bracket::after
{
content:" ";
display:block;
width:20px;
height:171px;
position:absolute;
top:-5px;
border:5px solid black;
}
.frame__bracket::before
{
border-right-width: 0px;
left:-20px;
}
.frame__bracket::after
{
border-left-width: 0px;
right:-20px;
}
2021-09-01 14:19:29 -04:00
2021-09-01 15:53:23 -04:00
.frame__button
2021-09-01 11:59:49 -04:00
{
2021-09-01 15:53:23 -04:00
position:relative;
display:block;
float:left;
2021-09-01 14:19:29 -04:00
padding:5px 0px 5px 0px;
2021-09-01 11:59:49 -04:00
box-sizing: border-box;
2021-09-01 15:53:23 -04:00
width:33.3%;
text-align:center;
}
.frame__button[data-frame-active='false']:hover::before
{
content: " ";
display: block;
width: 7px;
height: 7px;
background: black;
position: absolute;
top: -27px;
left: 50%;
transform: translateX(-5px) rotate(45deg);
}
.frame__button[data-frame-index="0"]:hover::before, .frame__button[data-frame-index="1"]:hover::before, .frame__button[data-frame-index="2"]:hover::before
{
top:auto;
bottom:-23px;
2021-09-01 11:59:49 -04:00
}
</style>
2021-09-01 15:53:23 -04:00
<div class="frame">
<div class="frame__image">
<img style="display:block; width:100%; height:auto;" src="https://via.placeholder.com/1024x512.png"/>
</div>
<div class="frame__button">Cover</div><div class="frame__button">Back </div><div class="frame__button">Spine</div>
<div class="frame__bar"><span></span></div>
<div class="frame__bracket"></div>
<div class="frame__button">Intro</div><div class="frame__button">1 & 2</div><div class="frame__button">3 & 4</div>
2021-09-01 11:59:49 -04:00
</div>
2021-09-01 14:19:29 -04:00
<script>
2021-09-01 15:53:23 -04:00
function frame__setup(inFrame)
2021-09-01 14:19:29 -04:00
{
2021-09-01 15:53:23 -04:00
var buttons = inFrame.querySelectorAll(".frame__button");
var bar = inFrame.querySelector(".frame__bar");
var active = false;
function activate(inButton)
{
var index = parseInt(inButton.getAttribute("data-frame-index"));
var classX = "frame__bar--" + ((index % 3)+1) + "-3";
var classY = index > 2 ? "frame__bar--down" : "frame__bar--up";
bar.setAttribute("class", "frame__bar " + classX + " " + classY);
if(active)
{
active.setAttribute("data-frame-active", "false");
}
active = inButton;
inButton.setAttribute("data-frame-active", "true");
}
function hover(inButton)
{
}
for(var i=0; i<buttons.length; i++)
{
buttons[i].setAttribute("data-frame-index", i);
buttons[i].setAttribute("data-frame-active", "false");
buttons[i].addEventListener("click", function(){ activate(this); });
}
activate( buttons[0] );
2021-09-01 14:19:29 -04:00
}
2021-09-01 15:53:23 -04:00
frame__setup(document.querySelector(".frame"));
2021-09-01 14:19:29 -04:00
</script>