epub.js
epub.js copied to clipboard
Setting the theme and then changing it back will not update
I found a strange problem, when I use epub.js ( v0.3.88 ) to set theme and then changing it back will not update, but if I use the unknow version js download from example and set theme twice, it works good.
But I can't make my project use that version of js directly, because it will make the page display nothing.
Here's the situation what I found in the release version js:
I registered two theme like these
rendition.themes.register("light",{ "body": { "background-color": "#FFFFFF", "color": "#000000" }, }); rendition.themes.register("dark",{ "body": { "background-color": "#111111", "color": "#D9D9D9" }, });
I called rendition.themes.select("light");
, it worked.
then rendition.themes.select("dark");
, it worked,
then rendition.themes.select("light");
, it doesn't worked.
I have same issue. Did you have the solution for this?
I have same issue. Did you have the solution for this?
I made it work at the cost of a noticeable page reload by adding two lines of code like this :
rendition.themes.select(value);
try {
rendition.clear();
rendition.start();
}
catch{ }
Obviously it's not a best solution, so I still hope the author can fix this problem.
seems like this hack doesn't work either
I've had this happen on my Aura One on stock software, even on very recent versions (<1 month ago)
I have the same issue. I'm using React Reader v1.2.1 which depends on epubjs v0.3.93. The themes object in rendition looks normal to me to reflect current selected theme. Not sure what's preventing it from getting rendered properly.
Using CSS is not affected
bookDeal.rendition.themes.register('light', "bookThemes.css");
bookDeal.rendition.themes.register('dark', "bookThemes.css");
bookDeal.rendition.themes.register('tan', "bookThemes.css");
css:
.light {
background: #fff;
color: #000;
}
.dark {
background: #232323;
color: #fff;
}
.tan {
background: tan;
color: #ccc;
}