joseph / Monocle

A silky, tactile browser-based ebook JavaScript library.
http://monocle.inventivelabs.com.au
MIT License
743 stars 200 forks source link

Font Size in Monocle #222

Open priti123 opened 10 years ago

priti123 commented 10 years ago

I am able to change the font size only for any one chapter in monocle. If i applied the font magnifier for another chapter its not reflecting the changes. Please help.

joloco commented 10 years ago

A late answer I know, but I've just figured this out myself.

Are you loading content as DOM Objects? Because if so, the monocle:componentmodify event never fires and then the part of Monocle which listens for this to keep the font size the same never runs.

My solution was to convert my XML DOM Object into a string using obj.html = (new XMLSerializer()).serializeToString(xml_object);

Monocle then treats it as an HTML string and therefore the monocle:componentmodify event fires, and the font size stays the same between chapters.

There are a couple of other small things which have changed now I've used this method (a blank page after my front cover, for example) but then coding is so often like pushing wallpaper-bubbles down – another two pop up somewhere else!