re-draw comic when page is resized
This commit is contained in:
parent
0995ea3ca3
commit
b2c5349113
7 changed files with 402 additions and 10 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue