ReedyBear's Blog

bugfix2 for book theme

For the updated code, see code for bearblog book theme. Just replace your old CSS & Javascript with what's on that post now.

bugfix1 added display:block to list elements because ... well it sort of fixed a problem where lists (like your 'all blog posts' page) caused the side-scrolling to just not work right. But it didn't completely fix it. It was a hacky solution. And after implementing bugfix2, bugfix1 was no longer needed.

So. Bugfix2.

First, I was incorrectly calculating the number of pages. TLDR, the calculated page-width and the measured page-width just don't seem to align perfectly. After the fix, they're still not perfectly aligned, but my updated calculation seems to work. The improper calculations were causing the right-scroll to stop before reaching the last page (bc my calculation determined there were fewer pages than actually existed)

Second, when scrolling long lists, some pages were being skipped. I was using a scroll-snap feature of CSS before, which allowed fixed-scrolling-widths when you used the scroll bar at the bottom of the book. I was targeting paragraph elements within posts as targets to snap to, which are direct children of <main> (which contains your full post). WELL. With list elements, the parent is <ul> and then each list item is <li>. I think the scroll snapping was breaking things because it was snapping to paragraph elements, and skipping pages of <li> elements. Targeting <li> would require main > ul > li so .... idk ... Rather than troubleshooting the scroll snapping to make it work for everything, I just removed the scroll snapping. It wasn't that important of a feature. I don't intend to re-implement the scroll-snap behavior.

#bearblog