Add books cover and slideshow with flickity
95
books.html
Normal file
|
@ -0,0 +1,95 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<title>fateforge-tools</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
|
||||
<link href="css/all.min.css" rel="stylesheet" />
|
||||
|
||||
<link href="css/flickity.css" rel="stylesheet" />
|
||||
<link href="css/style.css" rel="stylesheet" />
|
||||
<link rel="icon" type="image/x-icon" href="/img/FateforgeTool_logo_80.png">
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<button onclick="changeLangEN()"><img src="https://cdn.countryflags.com/thumbs/united-kingdom/flag-400.png"
|
||||
width="20"> English</button>
|
||||
<button onclick="changeLangFR()"><img src="https://cdn.countryflags.com/thumbs/france/flag-400.png" width="20">
|
||||
French</button>
|
||||
|
||||
<h1>FateforgeTools</h1>
|
||||
|
||||
<div class="gallery js-flickity">
|
||||
<div class="gallery-cell" id="ADV1">
|
||||
<div class="book-container">
|
||||
<div class="book">
|
||||
<img src="img\books\ADV1_BC_EN.jpg">
|
||||
|
||||
</div>
|
||||
<div class="book-title">Adventurer</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gallery-cell">
|
||||
<div class="book-container">
|
||||
<div class="book">
|
||||
<img src="img\books\GRI1_BC_EN.jpg">
|
||||
|
||||
</div>
|
||||
<div class="book-title">Grimoire</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gallery-cell" id="CRE2">
|
||||
<div class="book-container" data-localize="book-CRE2">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="gallery-cell">
|
||||
<div class="book-container">
|
||||
<div class="book">
|
||||
<img src="img\books\ENC1_BC_EN.png">
|
||||
|
||||
</div>
|
||||
<div class="book-title">Encyclopedia</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="gallery-cell">
|
||||
<div class="book-container">
|
||||
<div class="book">
|
||||
<img src="img\books\ENC2_DR.png">
|
||||
|
||||
</div>
|
||||
<div class="book-title">Encyclopedia : Netherworld</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><a href="#CRE2">View cell 2</a></div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="lib/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="lib/jquery.localize.js"></script>
|
||||
<script type="text/javascript" src="js/language.js"></script>
|
||||
<script src="lib/flickity.pkgd.min.js"></script>
|
||||
<script src="lib/flickity.hash.js"></script>
|
||||
<script>
|
||||
var flkty = new Flickity('.gallery', {
|
||||
"freeScroll": true, "wrapAround": true, "hash": true // options
|
||||
});
|
||||
flkty.on('select', function (index) {
|
||||
console.log('Flickity selected at ' + index);
|
||||
refreshBooks();
|
||||
});
|
||||
flkty.on('settle', function (index) {
|
||||
console.log('Flickity settled at ' + index);
|
||||
refreshBooks();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
137
css/flickity.css
Normal file
|
@ -0,0 +1,137 @@
|
|||
/*! Flickity v2.3.0
|
||||
https://flickity.metafizzy.co
|
||||
---------------------------------------------- */
|
||||
|
||||
.flickity-enabled {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.flickity-enabled:focus { outline: none; }
|
||||
|
||||
.flickity-viewport {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.flickity-slider {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* draggable */
|
||||
|
||||
.flickity-enabled.is-draggable {
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.flickity-enabled.is-draggable .flickity-viewport {
|
||||
cursor: move;
|
||||
cursor: -webkit-grab;
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down {
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* ---- flickity-button ---- */
|
||||
|
||||
.flickity-button {
|
||||
position: absolute;
|
||||
background: hsla(0, 0%, 100%, 0.75);
|
||||
border: none;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.flickity-button:hover {
|
||||
background: white;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.flickity-button:focus {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 5px #19F;
|
||||
}
|
||||
|
||||
.flickity-button:active {
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.flickity-button:disabled {
|
||||
opacity: 0.3;
|
||||
cursor: auto;
|
||||
/* prevent disabled button from capturing pointer up event. #716 */
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.flickity-button-icon {
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
/* ---- previous/next buttons ---- */
|
||||
|
||||
.flickity-prev-next-button {
|
||||
top: 50%;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 50%;
|
||||
/* vertically center */
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
.flickity-prev-next-button.previous { left: 10px; }
|
||||
.flickity-prev-next-button.next { right: 10px; }
|
||||
/* right to left */
|
||||
.flickity-rtl .flickity-prev-next-button.previous {
|
||||
left: auto;
|
||||
right: 10px;
|
||||
}
|
||||
.flickity-rtl .flickity-prev-next-button.next {
|
||||
right: auto;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
.flickity-prev-next-button .flickity-button-icon {
|
||||
position: absolute;
|
||||
left: 20%;
|
||||
top: 20%;
|
||||
width: 60%;
|
||||
height: 60%;
|
||||
}
|
||||
|
||||
/* ---- page dots ---- */
|
||||
|
||||
.flickity-page-dots {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: -25px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.flickity-rtl .flickity-page-dots { direction: rtl; }
|
||||
|
||||
.flickity-page-dots .dot {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin: 0 8px;
|
||||
background: #333;
|
||||
border-radius: 50%;
|
||||
opacity: 0.25;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.flickity-page-dots .dot.is-selected {
|
||||
opacity: 1;
|
||||
}
|
126
css/style.css
Normal file
|
@ -0,0 +1,126 @@
|
|||
/**** BOOK 3D***/
|
||||
*,
|
||||
:after,
|
||||
:before {
|
||||
box-sizing: border-box;
|
||||
border: 0 solid #e5e7eb;
|
||||
}
|
||||
|
||||
* {
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.book-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
perspective: 600px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.book-container .book {
|
||||
width: 200px;
|
||||
height: 300px;
|
||||
position: relative;
|
||||
transform-style: preserve-3d;
|
||||
transform: rotateY(-30deg);
|
||||
transition: transform 1s ease;
|
||||
animation: 1s ease 0s 1 initAnimation-fd6a;
|
||||
margin-bottom: 15px;
|
||||
margin-top: 39px;
|
||||
}
|
||||
|
||||
.book-container .book > :first-child {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 200px;
|
||||
height: 283px;
|
||||
transform: translateZ(25px);
|
||||
background-color: #01060f;
|
||||
border-radius: 0 2px 2px 0;
|
||||
box-shadow: 5px 5px 20px #aaaaaa9d;
|
||||
background-color: #01060f;
|
||||
}
|
||||
|
||||
.book-container .book::before {
|
||||
position: absolute;
|
||||
content: " ";
|
||||
left: 0;
|
||||
top: 3px;
|
||||
width: 48px;
|
||||
height: 277px;
|
||||
transform: translateX(172px) rotateY(90deg);
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
#fff 0%,
|
||||
#f9f9f9 5%,
|
||||
#fff 10%,
|
||||
#f9f9f9 15%,
|
||||
#fff 20%,
|
||||
#f9f9f9 25%,
|
||||
#fff 30%,
|
||||
#f9f9f9 35%,
|
||||
#fff 40%,
|
||||
#f9f9f9 45%,
|
||||
#fff 50%,
|
||||
#f9f9f9 55%,
|
||||
#fff 60%,
|
||||
#f9f9f9 65%,
|
||||
#fff 70%,
|
||||
#f9f9f9 75%,
|
||||
#fff 80%,
|
||||
#f9f9f9 85%,
|
||||
#fff 90%,
|
||||
#f9f9f9 95%,
|
||||
#fff 100%
|
||||
);
|
||||
}
|
||||
.book-container .book:hover {
|
||||
transform: rotateY(0deg);
|
||||
}
|
||||
|
||||
.book-container .book::after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
content: " ";
|
||||
width: 200px;
|
||||
height: 283px;
|
||||
transform: translateZ(-25px);
|
||||
background-color: #01060f;
|
||||
border-radius: 0 2px 2px 0;
|
||||
box-shadow: -05px 0 20px 10px #aaaaaa9d;
|
||||
}
|
||||
|
||||
.book-container .book-title {
|
||||
}
|
||||
|
||||
/**** Slideshow***/
|
||||
|
||||
.gallery {
|
||||
background: #01060f00;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.gallery-cell {
|
||||
width: 66%;
|
||||
|
||||
margin-right: 10px;
|
||||
|
||||
counter-increment: gallery-cell;
|
||||
}
|
||||
|
||||
.flickity-viewport {
|
||||
background-color: #01060f00;
|
||||
}
|
||||
.flickity-page-dots .dot {
|
||||
background: #0093cd;
|
||||
}
|
||||
.flickity-prev-next-button {
|
||||
border-radius: 6px;
|
||||
}
|
||||
.flickity-button {
|
||||
background: #588597;
|
||||
}
|
BIN
img/books/ADV1_BC_EN.jpg
Normal file
After Width: | Height: | Size: 253 KiB |
BIN
img/books/ADV1_BC_FR.png
Normal file
After Width: | Height: | Size: 2.1 MiB |
BIN
img/books/ADV1_BC_Textless.jpg
Normal file
After Width: | Height: | Size: 298 KiB |
BIN
img/books/ADV1_DR_Textless.jpg
Normal file
After Width: | Height: | Size: 239 KiB |
BIN
img/books/Box_DR.jpg
Normal file
After Width: | Height: | Size: 342 KiB |
BIN
img/books/Box_DR_2.jpg
Normal file
After Width: | Height: | Size: 224 KiB |
BIN
img/books/Box_GV.jpg
Normal file
After Width: | Height: | Size: 401 KiB |
BIN
img/books/Box_GV_2.jpg
Normal file
After Width: | Height: | Size: 401 KiB |
BIN
img/books/Box_GV_3.jpg
Normal file
After Width: | Height: | Size: 198 KiB |
BIN
img/books/CRE2_BC.png
Normal file
After Width: | Height: | Size: 645 KiB |
BIN
img/books/CRE2_DR.png
Normal file
After Width: | Height: | Size: 590 KiB |
BIN
img/books/ECR_GV.jpg
Normal file
After Width: | Height: | Size: 206 KiB |
BIN
img/books/ENC1_BC.png
Normal file
After Width: | Height: | Size: 1.7 MiB |
BIN
img/books/ENC1_BC_EN.png
Normal file
After Width: | Height: | Size: 357 KiB |
BIN
img/books/ENC1_DR.png
Normal file
After Width: | Height: | Size: 210 KiB |
BIN
img/books/ENC2_DR.png
Normal file
After Width: | Height: | Size: 1 MiB |
BIN
img/books/GRI1_BC.jpg
Normal file
After Width: | Height: | Size: 520 KiB |
BIN
img/books/GRI1_BC_EN.jpg
Normal file
After Width: | Height: | Size: 742 KiB |
BIN
img/books/GRI1_BC_Textless.jpg
Normal file
After Width: | Height: | Size: 221 KiB |
BIN
img/books/GRI1_DR_Textless.jpg
Normal file
After Width: | Height: | Size: 221 KiB |
BIN
img/books/GUI1_BC.jpg
Normal file
After Width: | Height: | Size: 427 KiB |
BIN
img/books/GUI1_BC_EN.jpg
Normal file
After Width: | Height: | Size: 352 KiB |
BIN
img/books/GUI2_BC.jpg
Normal file
After Width: | Height: | Size: 633 KiB |
BIN
img/books/LEG1_BC_Textless.jpg
Normal file
After Width: | Height: | Size: 210 KiB |
BIN
img/books/LEG2.png
Normal file
After Width: | Height: | Size: 429 KiB |
BIN
img/books/LEG3.png
Normal file
After Width: | Height: | Size: 523 KiB |
|
@ -9,5 +9,6 @@
|
|||
"btn-items": "Magic Items",
|
||||
"CUVD": "Unofficial site for Fateforge RPG. Uses copyrighted content © Agate RPG, courtesy of the publisher under the CUVD license.",
|
||||
"link": "Join the community: <a href='https://fateforge.org/en'>https://fateforge.org/en</a>",
|
||||
"btn-books": "Books"
|
||||
"btn-books": "Books",
|
||||
"book-CRE2": "<div class='book'> <img src='img\\books\\CRE2_BC_EN.png'></div><div class='book-title'>Creature : Netherworld</div>"
|
||||
}
|
||||
|
|
|
@ -14,5 +14,6 @@
|
|||
"somatic": "Gestuelle",
|
||||
"gridColumns":{
|
||||
"components": "Composants"
|
||||
}
|
||||
},
|
||||
"book-CRE2": "<div class='book'> <img src='img\\books\\CRE2_BC.png'></div><div class='book-title'>Créature : Inframonde</div>"
|
||||
}
|
||||
|
|
121
lib/flickity.hash.js
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*!
|
||||
* Flickity hash v1.0.3
|
||||
* Enable hash navigation for Flickity
|
||||
*/
|
||||
|
||||
/*jshint browser: true, undef: true, unused: true, strict: true*/
|
||||
|
||||
( function( window, factory ) {
|
||||
// universal module definition
|
||||
/*jshint strict: false */ /*globals define, module, require */
|
||||
if ( typeof define == 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( [
|
||||
'flickity/js/index',
|
||||
], factory );
|
||||
} else if ( typeof module == 'object' && module.exports ) {
|
||||
// CommonJS
|
||||
module.exports = factory(
|
||||
require('flickity')
|
||||
);
|
||||
} else {
|
||||
// browser global
|
||||
factory(
|
||||
window.Flickity
|
||||
);
|
||||
}
|
||||
|
||||
}( window, function factory( Flickity ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
Flickity.createMethods.push('_createHash');
|
||||
|
||||
var proto = Flickity.prototype;
|
||||
|
||||
proto._createHash = function() {
|
||||
if ( !this.options.hash ) {
|
||||
return;
|
||||
}
|
||||
this.connectedHashLinks = [];
|
||||
// hash link listener
|
||||
// use HTML5 history pushState to prevent page scroll jump
|
||||
this.onHashLinkClick = function( event ) {
|
||||
event.preventDefault();
|
||||
this.selectCell( event.currentTarget.hash );
|
||||
history.replaceState( null, '', event.currentTarget.hash );
|
||||
}.bind( this );
|
||||
|
||||
// events
|
||||
this.on( 'activate', this.activateHash );
|
||||
this.on( 'deactivate', this.deactivateHash );
|
||||
};
|
||||
|
||||
proto.activateHash = function() {
|
||||
this.on( 'change', this.onChangeHash );
|
||||
|
||||
// overwrite initialIndex
|
||||
if ( this.options.initialIndex === undefined && location.hash ) {
|
||||
var cell = this.queryCell( location.hash );
|
||||
if ( cell ) {
|
||||
this.options.initialIndex = this.getCellSlideIndex( cell );
|
||||
}
|
||||
}
|
||||
|
||||
this.connectHashLinks();
|
||||
};
|
||||
|
||||
|
||||
proto.deactivateHash = function() {
|
||||
this.off( 'change', this.onChangeHash );
|
||||
this.disconnectHashLinks();
|
||||
};
|
||||
|
||||
proto.onChangeHash = function() {
|
||||
var id = this.selectedElement.id;
|
||||
if ( id ) {
|
||||
var url = '#' + id;
|
||||
history.replaceState( null, '', url );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
proto.connectHashLinks = function() {
|
||||
var links = document.querySelectorAll('a');
|
||||
for ( var i=0; i < links.length; i++ ) {
|
||||
this.connectHashLink( links[i] );
|
||||
}
|
||||
};
|
||||
|
||||
// used to test if link is on same page
|
||||
var proxyLink = document.createElement('a');
|
||||
|
||||
proto.connectHashLink = function( link ) {
|
||||
if ( !link.hash ) {
|
||||
return;
|
||||
}
|
||||
// check that link is for the same page
|
||||
proxyLink.href = link.href;
|
||||
if ( proxyLink.pathname != location.pathname ) {
|
||||
return;
|
||||
}
|
||||
var cell = this.queryCell( link.hash );
|
||||
if ( !cell ) {
|
||||
return;
|
||||
}
|
||||
link.addEventListener( 'click', this.onHashLinkClick );
|
||||
this.connectedHashLinks.push( link );
|
||||
};
|
||||
|
||||
proto.disconnectHashLinks = function() {
|
||||
this.connectedHashLinks.forEach( function( link ) {
|
||||
link.removeEventListener( 'click', this.onHashLinkClick );
|
||||
}, this );
|
||||
this.connectedHashLinks = [];
|
||||
};
|
||||
|
||||
// ----- ----- //
|
||||
|
||||
return Flickity;
|
||||
|
||||
}));
|