1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +02:00
epub.js/examples/offline.html
2015-07-23 08:16:43 -04:00

129 lines
2.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ePubJS Offline Example</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- EPUBJS Renderer -->
<script src="../build/epub.js"></script>
<script src="../build/libs/localforage.min.js"></script>
<style type="text/css">
body {
overflow: hidden;
}
#main {
position: absolute;
width: 100%;
height: 100%;
}
#area {
width: 80%;
height: 80%;
margin: 5% auto;
max-width: 1250px;
}
#area iframe {
border: none;
}
#prev {
left: 40px;
}
#next {
right: 40px;
}
.arrow {
position: absolute;
top: 50%;
margin-top: -32px;
font-size: 64px;
color: #E2E2E2;
font-family: arial, sans-serif;
font-weight: bold;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.arrow:hover {
color: #777;
}
.arrow:active {
color: #000;
}
#offline {
position: fixed;
top: -40px;
left: 0;
background-color: yellow;
width: 100%;
text-align: center;
padding: 10px 0;
-webkit-transition: top .5s;
transition: top .5s;
}
</style>
<script>
"use strict";
var Book = ePub("../reader/moby-dick/", {
storage: true
});
// Name may appear during storage limit prompts
// and used as a key prefix for all keys stored in localStorage
// Change to the name of your app
localforage.config({
name: 'epubjs'
});
</script>
</head>
<body>
<div id="offline">You are offline. Loading from Storage.</div>
<div id="main">
<div id="prev" onclick="Book.prevPage();" class="arrow"></div>
<div id="area"></div>
<div id="next" onclick="Book.nextPage();"class="arrow"></div>
</div>
<script>
var msg = document.getElementById('offline');
Book.renderTo("area");
Book.on("book:online", function () {
console.log("online");
msg.style.top = "-40px";
});
Book.on("book:offline", function () {
console.log("offline");
msg.style.top = "0px";
});
Book.on("book:stored", function () {
console.log("stored");
});
</script>
</body>
</html>