Generate a seperate footer in last page using paged.js

366 Views Asked by At

I'm trying to generate a seperate footer for the last page using paged.js. The total number of pages is dynamic.

I already tried named page method but couldn't succeed because it generated extra empty page at the last although it gave the correct final page footer at the last.

Does anyone can help me on this?

1

There are 1 best solutions below

2
On

Currently, Paged.js doesn't have a selector for the last page like :last.

From your question, I understand you intend to target the last page that has content. Your named page method doesn't work because named pages rely on a class to call them, and that class has to be added on an element or section which would be on a different page layout. You would have to manually see how much of the text is on the last page and put it in a div with a named page class for this approach to work.

I suspect the only other way to do it for now is to generate the book, manually see how many pages there are and type it in the @page :nth() pseudoclass.

Context: I attempted to set a rule with @page :nth(counter(pages)) but the counter seems to work only inside curly braces. This caused paged.js to fail.