diff options
author | Adam T. Carpenter <atc@53hor.net> | 2024-11-14 21:49:47 -0500 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2024-11-14 21:49:47 -0500 |
commit | 4aa45ef3e7798ee18bea8b49af75e383afce02a1 (patch) | |
tree | 7a1353753d9300929b43a561ff2f1aae59b6434f /templates/brochure | |
parent | 014e34fa4a8cd4e3cdb3573a7748696c68873523 (diff) | |
parent | fc0e8296178ca779a270d91b681777f50b3b626d (diff) | |
download | carpentertutoring-master.tar.xz carpentertutoring-master.zip |
Diffstat (limited to 'templates/brochure')
-rw-r--r-- | templates/brochure/brochure.css | 93 | ||||
-rw-r--r-- | templates/brochure/brochure.html | 37 | ||||
-rw-r--r-- | templates/brochure/brochure.js | 34 | ||||
-rw-r--r-- | templates/brochure/index.html | 32 |
4 files changed, 196 insertions, 0 deletions
diff --git a/templates/brochure/brochure.css b/templates/brochure/brochure.css new file mode 100644 index 0000000..2abb118 --- /dev/null +++ b/templates/brochure/brochure.css @@ -0,0 +1,93 @@ +/* +Copyright (c) 2024 by Daniel Pox (https://codepen.io/danielpox/pen/abOopYo) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + + +.paper { + display: grid; + + width: 8.25rem; + + grid-template-columns: 8.25rem; + grid-template-rows: 19.41rem; /* .425 aspect */ + + margin: 2rem auto; + + transform-style: preserve-3d; + transition: transform linear 1s; +} +.paper.flip { + transform: rotateY(180deg); +} + +.paper .page { + display: inline-block; + + grid-column: 1 / 2; + grid-row: 1 / 2; + + position: relative; + + transform-style: preserve-3d; + + box-shadow: 0 4px 8px #0001; +} + +.paper .page .side { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + + background: white; + backface-visibility: hidden; +} + +.paper .page .side.back { + transform: rotateY(180deg); +} + +.page { + transition: transform linear 1s; +} +.left.open { + transform: rotateY(-180deg); +} +.right.open { + transform: rotateY(180deg); +} + +.paper .page .side { + box-shadow: inset 1px 0 #f2f2f2, inset -1px 0 #f2f2f2; +} + +.side img { + max-width: 100%; + max-height: 100%; +} + +.left { + transform: translateZ(2px); + transform-origin: center left; +} + +.right { + transform: translateZ(1px); + transform-origin: center right; +} + +@media only screen and (min-width: 1500px) { + .paper { + width: 21.25em; + + grid-template-columns: 21.25em; + grid-template-rows: 50em; /* .425 aspect */ + } +} diff --git a/templates/brochure/brochure.html b/templates/brochure/brochure.html new file mode 100644 index 0000000..b5a3cd3 --- /dev/null +++ b/templates/brochure/brochure.html @@ -0,0 +1,37 @@ +<!-- +Copyright (c) 2024 by Daniel Pox (https://codepen.io/danielpox/pen/abOopYo) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +--> + +<button class="button">Flip</button> +<div class="paper"> + <div class="page left"> + <div class="side front"> + <img src="/assets/brochure/brochure-front-left.png"/> + </div> + <div class="side back"> + <img src="/assets/brochure/brochure-back-left.png"/> + </div> + </div> + <div class="page right"> + <div class="side front"> + <img src="/assets/brochure/brochure-front-right.png"/> + </div> + <div class="side back"> + <img src="/assets/brochure/brochure-back-right.png"/> + </div> + </div> + <div class="page center"> + <div class="side front"> + <img src="/assets/brochure/brochure-front-center.png"/> + </div> + <div class="side back"> + <img src="/assets/brochure/brochure-back-center.png"/> + </div> + </div> +</div> diff --git a/templates/brochure/brochure.js b/templates/brochure/brochure.js new file mode 100644 index 0000000..4872373 --- /dev/null +++ b/templates/brochure/brochure.js @@ -0,0 +1,34 @@ +/* +Copyright (c) 2024 by Daniel Pox (https://codepen.io/danielpox/pen/abOopYo) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + + +document.addEventListener("DOMContentLoaded", (event) => { + const paper = document.querySelector(".paper"); + + const flipButton = document.querySelector("button") + flipButton.addEventListener("click", () => { + paper.classList.toggle("flip") + }) + + const leftSide = paper.querySelector(".page.left"); + leftSide.addEventListener("click", () => { + leftSide.classList.toggle("open") + }); + + const rightSide = paper.querySelector(".page.right"); + rightSide.addEventListener("click", () => { + rightSide.classList.toggle("open") + }); + + const centerSide = paper.querySelector(".page.center"); + centerSide.addEventListener("click", () => { + centerSide.classList.toggle("open") + }); +}); diff --git a/templates/brochure/index.html b/templates/brochure/index.html new file mode 100644 index 0000000..41a62f4 --- /dev/null +++ b/templates/brochure/index.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} + +{% block style %} + {% include "../styles.css" %} + {% include "brochure.css" %} +{% endblock %} + +{% block main %} +<section class="banner"> + <h1>Interactive Brochure</h1> +</section> + +<section class="quiet"> + <noscript> + This brochure requires JavaScript to work properly. If you prefer not to use JavaScript, you can <a href="/#offerings">view our offerings on our homepage here.</a> + </noscript> + + <p> + Click on pages to fold and unfold and use <em>Flip</em> to toggle front and back. This works best on a tablet or desktop screen. + </p> + + {% include "brochure.html" %} + +</section> + +<section></section> + +<script> + {% include "brochure.js" %} +</script> + +{% endblock %} |