@fbrzvnrnd: I only have very limited JavaScript skills, but, IMHO, the code looks OK. This appears to be an iBooks
bug feature.
The animation actually works with iBooks, but only once. (If you have a very fast Mac or iPad your might not even see it.)
It looks like iBooks caches chapter html files and doesn't reload them when they're re-selected via the TOC.
A workaround would be to disable the animation for iBooks apps.
You can test for iBooks apps with the following JavaScript function:
Code:
navigator.epubReadingSystem.name
It should return
iBooks.