#177 Nebraska-Man strip show scrollable view on mobile

This commit is contained in:
neil 2022-11-05 15:26:44 +08:00
parent 2907cfa4e0
commit fc4a93a26c
2 changed files with 103 additions and 80 deletions

View file

@ -36,23 +36,23 @@
justify-content: center; justify-content: center;
margin: 5%; margin: 5%;
width: 90%; width: 90%;
} }
.aspect { .aspect {
padding-bottom: 70%; padding-bottom: 70%;
position: relative; position: relative;
width: 100%; width: 100%;
} }
.aspect-inner { .aspect-inner {
bottom: 0; bottom: 0;
left: 0; left: 0;
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;
} }
.flipbook { .flipbook {
height: 100%; height: 100%;
transition: margin-left 0.25s ease-out; transition: margin-left 0.25s ease-out;
width: 100%; width: 100%;
@ -62,42 +62,56 @@
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
.flipbook .page { .flipbook .page {
height: 100%;
width: 100%;
}
.flipbook .page img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.flipbook .page img {
width: 100%;
height: 100%;
}
/* .flipbook.desktop .page {
height: 100%;
}
.flipbook.desktop .page img {
height: 100%;
} */
#comicstrip #desktop_view {
display: none;
}
#comistrip #flipbook_mobile {
display: block;
}
#comicstrip.desktop #desktop_view {
display: flex;
}
#comicstrip.desktop #flipbook_mobile {
display: none;
}
</style> </style>
<section class="nb-man-latest"> <section class="nb-man-latest">
<div class="container"> <div class="container" id="comicstrip">
<div class="row"> <div class="row" id="desktop_view">
<div class="col"> <div class="col">
<div class="wrapper"> <div class="wrapper">
<div class="aspect"> <div class="aspect">
<div class="aspect-inner"> <div class="aspect-inner">
<div class="flipbook" id="flipbook"> {{- partial "nebraska-man-001.html" "flipbook_desktop" -}}
<div class="page"><img src="/Images/nb-man-cover-one.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_01.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_02.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_03.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_04.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_05.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_06.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_07.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_08.jpg" draggable="false" alt="" /></div>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{{- partial "nebraska-man-001.html" "flipbook_mobile" -}}
</div> </div>
</section> </section>
@ -187,45 +201,43 @@
<script type="text/javascript"> <script type="text/javascript">
function loadApp() { const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
function loadApp() {
// Create the flipbook // Create the flipbook
$('.flipbook').turn({ $('.flipbook').turn({
// Enable gradients // Enable gradients
gradients: true, gradients: true,
// Auto center this flipbook // Auto center this flipbook
autoCenter: true autoCenter: true
}); });
} }
// Load the HTML4 version if there's not CSS transform if (!isMobile) {
const comicstripEl = document.getElementById('comicstrip');
comicstripEl.classList.add('desktop');
yepnope({ const flipbookEL = document.getElementById('flipbook_desktop');
// Load the HTML4 version if there's not CSS transform
yepnope({
test : Modernizr.csstransforms, test : Modernizr.csstransforms,
yep: ['/js/turn.js'], yep: ['/js/turn.js'],
nope: ['/js/turn.html4.min.js'], nope: ['/js/turn.html4.min.js'],
both: ['/css/basic.css'], both: ['/css/basic.css'],
complete: loadApp complete: loadApp
}); });
var flipbookEL = document.getElementById('flipbook'); window.addEventListener('resize', function (e) {
window.addEventListener('resize', function (e) {
flipbookEL.style.width = ''; flipbookEL.style.width = '';
flipbookEL.style.height = ''; flipbookEL.style.height = '';
$(flipbookEL).turn('size', flipbookEL.clientWidth, flipbookEL.clientHeight); $(flipbookEL).turn('size', flipbookEL.clientWidth, flipbookEL.clientHeight);
}); });
$(flipbookEL).turn({ $(flipbookEL).turn({
autoCenter: true autoCenter: true
}); });
}
</script> </script>

View file

@ -0,0 +1,11 @@
<div class="flipbook" id="{{- . -}}">
<div class="page"><img src="/Images/nb-man-cover-one.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_01.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_02.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_03.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_04.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_05.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_06.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_07.jpg" draggable="false" alt="" /></div>
<div class="page"><img src="/Images/nebraksa_man/Nebraska_Man_08.jpg" draggable="false" alt="" /></div>
</div>