devo-book/index.html

348 lines
9.8 KiB
HTML
Raw Normal View History

2021-08-04 13:12:35 -04:00
<!DOCTYPE html>
<html>
<head>
<style>
body
{
margin:0;
}
section
{
position:relative;
height: 100vh;
box-sizing: border-box;
2021-08-04 16:00:10 -04:00
padding:50px;
2021-08-04 13:12:35 -04:00
}
nav
{
position:fixed;
right:50px;
bottom:50px;
z-index:10;
}
h2
{
width:500px;
margin:0 auto;
text-align:center;
}
h2[data-spy='true']
{
background:black;
color: white;;
}
</style>
2021-08-04 16:00:10 -04:00
<script>
var Time =
{
Jobs:[],
Stamp:false,
Queue:false,
Loop:false,
Add:function(inJob)
{
if(Time.Loop)
{
console.log("cannot modify queue while processing");
return;
}
if(!Time.Queue)
{
window.requestAnimationFrame(Time.Update);
}
Time.Queue = true;
Time.Jobs.push(inJob);
},
Remove:function(inJob)
{
if(Time.Loop)
{
console.log("cannot modify queue while processing");
return;
}
var index = Time.Jobs.indexOf(inJob);
if(index > -1)
{
Time.Jobs.splice(index, 1);
}
},
Update:function(inTimestamp)
{
var delta;
var i;
if(!Time.Stamp)
{
Time.Stamp = inTimestamp;
}
delta = inTimestamp - Time.Stamp;
Time.Stamp = inTimestamp;
Time.Loop = true;
for(i=0; i<Time.Jobs.length; i++)
{
if(Time.Jobs[i](delta) === false)
{
Time.Jobs.splice(i, 1);
i--;
}
}
Time.Loop = false;
if(Time.Jobs.length > 0)
{
window.requestAnimationFrame(Time.Update);
}
else
{
Time.Stamp = false;
Time.Queue = false;
}
}
};
</script>
<script>
var Spy =
{
Attribute:"data-spy",
Members:[],
Defaults:[0, 1, 0, 1],
Disabled:false,
Suspend:function()
{
Spy.Disabled = true;
},
Resume:function()
{
Spy.Disabled = false;
Spy.UpdateAll();
},
UpdateAll:function()
{
var i, member, aabb, top, bottom, left, right;
var visible;
if(Spy.Disabled){ return; }
for(i=0; i<Spy.Members.length; i++)
{
member = Spy.Members[i];
top = window.innerHeight * member.Bounds[0];
bottom = window.innerHeight * member.Bounds[1];
left = window.innerWidth * member.Bounds[2];
right = window.innerWidth * member.Bounds[3];
aabb = member.Element.getBoundingClientRect();
visible = (aabb.top < bottom && aabb.bottom > top) && (aabb.left < right && aabb.right > left);
if(visible != member.Visible)
{
member.Element.setAttribute(Spy.Attribute, visible);
member.Visible = visible;
member.Change(visible);
}
}
},
Create:function(inElement)
{
var j, bounds;
var attr;
var obj;
attr = inElement.getAttribute(Spy.Attribute)||"";
inElement.removeAttribute(Spy.Attribute);
bounds = attr.split("|");
for(j=0; j<Spy.Defaults.length; j++)
{
if(bounds[j])
{
bounds[j] = parseFloat(bounds[j]);
}
else
{
bounds[j] = Spy.Defaults[j];
}
}
obj = {
Element:inElement,
Bounds:bounds,
Visible:undefined,
Change:function(){}
};
Spy.Members.push(obj);
return obj;
},
CreateAll:function()
{
var i, elements;
elements = document.querySelectorAll("*["+Spy.Attribute+"]");
for(i=0; i<elements.length; i++)
{
Spy.Create(elements[i]);
}
},
Init:function()
{
Spy.CreateAll();
Spy.UpdateAll();
document.addEventListener("scroll", Spy.UpdateAll, {passive:true});
window.addEventListener("resize", Spy.UpdateAll, {passive:true});
}
};
</script>
2021-08-04 13:12:35 -04:00
</head>
<body>
<nav>
<a href="#top" >Top</a>
<a href="#order">Order</a>
<a href="#video">Video</a>
<a href="#about">About</a>
<a href="#specs">Specs</a>
<a href="#email">Sign-up</a>
</nav>
2021-08-04 16:00:10 -04:00
<section id="order">
2021-08-04 16:51:40 -04:00
<style>
.shot3d
{
2021-08-05 09:46:25 -04:00
transform: perspective(1000px) rotateY(25deg);
transform-style: preserve-3d;
2021-08-04 16:51:40 -04:00
perspective-origin: 50% 50%;
2021-08-04 17:53:51 -04:00
2021-08-05 09:46:25 -04:00
position: relative;
width: 350px;
height: 350px;
line-height: 350px;
2021-08-04 17:53:51 -04:00
text-align:center;
white-space: nowrap;
2021-08-04 16:51:40 -04:00
}
2021-08-05 09:46:25 -04:00
.shot3d__shadow
2021-08-04 16:51:40 -04:00
{
2021-08-04 17:53:51 -04:00
display: inline;
position: relative;
2021-08-05 09:46:25 -04:00
2021-08-04 17:53:51 -04:00
font-size: 0px;
line-height:0;
2021-08-05 09:46:25 -04:00
vertical-align: bottom;
2021-08-04 17:53:51 -04:00
}
2021-08-05 09:46:25 -04:00
.shot3d__shadow::after, .shot3d__shadow::before
2021-08-04 17:53:51 -04:00
{
2021-08-05 09:46:25 -04:00
transform-origin: center 30px;
2021-08-04 17:53:51 -04:00
position: absolute;
2021-08-05 09:46:25 -04:00
padding: 0 6px 0 6px;
2021-08-04 17:53:51 -04:00
content: " ";
top: 100%;
2021-08-05 09:46:25 -04:00
left: -6px;
2021-08-04 17:53:51 -04:00
width: 100%;
2021-08-05 09:46:25 -04:00
height: 6px;
border-radius: 6px;
box-shadow: 0px 30px 14px black, 0px 43px 22px black, 0px 60px 33px black;
2021-08-04 17:53:51 -04:00
}
2021-08-05 09:46:25 -04:00
.shot3d__shadow::before{ transform: translateY(-30px) rotateX(-90deg) translateY( 5px); }
.shot3d__shadow::after { transform: translateY(-30px) rotateX( 90deg) translateY( 5px); }
.shot3d__shadow img
2021-08-04 17:53:51 -04:00
{
vertical-align: bottom;
display: inline;
max-width: 100%;
max-height: 100%;
2021-08-04 16:51:40 -04:00
}
</style>
<div class="shot3d">
2021-08-05 09:46:25 -04:00
<div class="shot3d__shadow">
2021-08-04 17:05:27 -04:00
<!-- <img src="https://truthforlife.org/static/images/productimage-picture-encore-2021-9729.jpg"/> -->
2021-08-04 17:53:51 -04:00
<div>
<img src="https://placekitten.com/100/200"/>
2021-08-05 09:46:25 -04:00
<img class="panel panel--front" src="https://placekitten.com/400/800"/>
2021-08-04 17:53:51 -04:00
</div>
2021-08-04 16:51:40 -04:00
</div>
2021-08-04 16:00:10 -04:00
<h2 data-spy="0.2|0.8">Order</h2>
<h3>Truth For Life</h3>
<h4>365 Daily Devotionals</h4>
<h5>by Alistair Begg</h5>
<p>
Duis augue neque, dignissim at diam ac, mattis cursus justo. Morbi blandit in ligula eu scelerisque.
Maecenas hendrerit eu nunc non molestie. Vivamus augue enim, egestas a magna vitae, consequat facilisis urna.
Nullam semper ligula in est tincidunt, vel fringilla nunc vehicula. Nam tempus pellentesque ante, nec iaculis nisi porta id.
Ut aliquet purus nec mi egestas ornare.
</p>
<a href="https://truthforlife.org/store/buy/">Buy Now</a>
<span>$10.00 (free shipping)</span>
</section>
2021-08-04 13:12:35 -04:00
<section id="video">
<h2 data-spy="0.2|0.8">Videos</h2>
2021-08-04 16:00:10 -04:00
2021-08-04 13:12:35 -04:00
</section>
<section id="about">
<h2 data-spy="0.2|0.8">About</h2>
2021-08-04 16:00:10 -04:00
<p>
Duis augue neque, dignissim at diam ac, mattis cursus justo. Morbi blandit in ligula eu scelerisque.
Maecenas hendrerit eu nunc non molestie. Vivamus augue enim, egestas a magna vitae, consequat facilisis urna.
Nullam semper ligula in est tincidunt, vel fringilla nunc vehicula. Nam tempus pellentesque ante, nec iaculis nisi porta id.
Ut aliquet purus nec mi egestas ornare.
</p>
<ul>
<li>
<strong>Head</strong><p>Nam tempus pellentesque ante, nec iaculis nisi porta id.</p>
</li>
<li>
<strong>Hands</strong><p>Vivamus augue enim, egestas a magna vitae, consequat facilisis urna.</p>
</li>
<li>
<strong>Heart</strong><p>Morbi blandit in ligula eu scelerisque. Maecenas hendrerit eu nunc non molestie.</p>
</li>
</ul>
<a href="#">Look Inside</a>
2021-08-04 13:12:35 -04:00
</section>
<section id="specs">
<h2 data-spy="0.2|0.8">Specs</h2>
</section>
2021-08-04 16:00:10 -04:00
<section id="email">
<h2 data-spy="0.2|0.8">Sign Up</h2>
</section>
2021-08-04 13:12:35 -04:00
<script>
2021-08-04 16:00:10 -04:00
Spy.Init();
2021-08-04 14:38:48 -04:00
function JobDuration(inDuration, inHandler, inDone)
2021-08-04 13:12:35 -04:00
{
var timeCurrent = 0;
var timeLimit = inDuration*1000;
var timeRelative = 0;
var timeMaxed = false;
return function(inDelta)
{
timeCurrent += inDelta;
timeMaxed = timeCurrent > timeLimit;
2021-08-04 14:38:48 -04:00
if(timeMaxed)
{
inHandler(1);
inDone();
return false;
}
return inHandler(timeCurrent / timeLimit);
2021-08-04 13:12:35 -04:00
};
}
document.querySelector("nav").addEventListener("click", function(inEvent)
{
2021-08-04 14:38:48 -04:00
var domHtml = document.querySelector("html");
var domGoal = document.querySelector(inEvent.target.getAttribute("href"));
2021-08-04 16:00:10 -04:00
var posStart = domHtml.scrollTop;
2021-08-04 14:38:48 -04:00
var posRange = domGoal.getBoundingClientRect().top;
var evtTick = function(inProgress){ domHtml.scrollTop = posStart + posRange*Math.sqrt(1 - Math.pow(1-(inProgress), 2)); };
var evtDone = function(){ Spy.Resume(); };
Spy.Suspend();
Time.Add( JobDuration(0.4, evtTick, evtDone) );
2021-08-04 13:12:35 -04:00
inEvent.preventDefault();
});
</script>
</body>
</html>