re-draw comic when page is resized

This commit is contained in:
Bala Clark 2015-07-19 15:00:38 +02:00
parent 0995ea3ca3
commit b2c5349113
7 changed files with 402 additions and 10 deletions

View file

@ -1,4 +1,5 @@
let ComicBook = window.ComicBook = require('./comic-book')
let debounce = require('lodash.debounce')
let srcs = [
'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_00.jpg',
'https://raw.githubusercontent.com/balaclark/HTML5-Comic-Book-Reader/master/examples/goldenboy/goldenboy_01.jpg',
@ -16,6 +17,8 @@ let comic = window.comic = new ComicBook(srcs, { doublePage: true })
comic.render()
window.addEventListener('resize', debounce(comic.drawPage.bind(comic), 100))
document.addEventListener('DOMContentLoaded', () => {
document.body.appendChild(comic.el)
}, false)