How to implement counter of pages?
I'm trying to implement page counter in my app. Imagine microsoft word document with 5 pages. When user scrolls from page 1 to page 2 - counter should display 1/5 --> 2/5. Currently I'm looking for some advices how to implement such counter with JS in React APP.
I've tried to implement scrollspy:
https://materializecss.com/scrollspy.html
In my app there is continuous page, with arrowPointer at the 'end' of each page (A4 format). Every 800px there is arrowPointer. I've tried implement scrollspy logic. When user scrolling, new arrowPointer appears and counter should accumulate.
javascript scroll pagination counter
add a comment |
I'm trying to implement page counter in my app. Imagine microsoft word document with 5 pages. When user scrolls from page 1 to page 2 - counter should display 1/5 --> 2/5. Currently I'm looking for some advices how to implement such counter with JS in React APP.
I've tried to implement scrollspy:
https://materializecss.com/scrollspy.html
In my app there is continuous page, with arrowPointer at the 'end' of each page (A4 format). Every 800px there is arrowPointer. I've tried implement scrollspy logic. When user scrolling, new arrowPointer appears and counter should accumulate.
javascript scroll pagination counter
1
Hello, and welcome to Stackoverflow. Please read stackoverflow.com/help/how-to-ask and stackoverflow.com/help/mcve . Please note that Stackoverflow is not a coding service, and we expect you to have done your research and come up with an attempt at solving your own task.
– maximelian1986
Jan 3 at 13:34
add a comment |
I'm trying to implement page counter in my app. Imagine microsoft word document with 5 pages. When user scrolls from page 1 to page 2 - counter should display 1/5 --> 2/5. Currently I'm looking for some advices how to implement such counter with JS in React APP.
I've tried to implement scrollspy:
https://materializecss.com/scrollspy.html
In my app there is continuous page, with arrowPointer at the 'end' of each page (A4 format). Every 800px there is arrowPointer. I've tried implement scrollspy logic. When user scrolling, new arrowPointer appears and counter should accumulate.
javascript scroll pagination counter
I'm trying to implement page counter in my app. Imagine microsoft word document with 5 pages. When user scrolls from page 1 to page 2 - counter should display 1/5 --> 2/5. Currently I'm looking for some advices how to implement such counter with JS in React APP.
I've tried to implement scrollspy:
https://materializecss.com/scrollspy.html
In my app there is continuous page, with arrowPointer at the 'end' of each page (A4 format). Every 800px there is arrowPointer. I've tried implement scrollspy logic. When user scrolling, new arrowPointer appears and counter should accumulate.
javascript scroll pagination counter
javascript scroll pagination counter
edited Jan 3 at 13:43
matrixb0ss
asked Jan 3 at 13:32
matrixb0ssmatrixb0ss
255
255
1
Hello, and welcome to Stackoverflow. Please read stackoverflow.com/help/how-to-ask and stackoverflow.com/help/mcve . Please note that Stackoverflow is not a coding service, and we expect you to have done your research and come up with an attempt at solving your own task.
– maximelian1986
Jan 3 at 13:34
add a comment |
1
Hello, and welcome to Stackoverflow. Please read stackoverflow.com/help/how-to-ask and stackoverflow.com/help/mcve . Please note that Stackoverflow is not a coding service, and we expect you to have done your research and come up with an attempt at solving your own task.
– maximelian1986
Jan 3 at 13:34
1
1
Hello, and welcome to Stackoverflow. Please read stackoverflow.com/help/how-to-ask and stackoverflow.com/help/mcve . Please note that Stackoverflow is not a coding service, and we expect you to have done your research and come up with an attempt at solving your own task.
– maximelian1986
Jan 3 at 13:34
Hello, and welcome to Stackoverflow. Please read stackoverflow.com/help/how-to-ask and stackoverflow.com/help/mcve . Please note that Stackoverflow is not a coding service, and we expect you to have done your research and come up with an attempt at solving your own task.
– maximelian1986
Jan 3 at 13:34
add a comment |
1 Answer
1
active
oldest
votes
This will display page numbers, but not the total number of pages:
footer {
position:fixed;
bottom:0;
left:0;
}
body {
counter-reset: page_number;
}
#page-number:after {
counter-increment: page_number;
content: "Page " counter(page_number);
}
Having something like
<p id='page-number'></p>
in the footer.
Browser: Firefox 19.0.2
More info: How can I count CSS page breaks for printed HTML?
Thank you Fran!
– matrixb0ss
Jan 3 at 14:00
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54023302%2fhow-to-implement-counter-of-pages%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This will display page numbers, but not the total number of pages:
footer {
position:fixed;
bottom:0;
left:0;
}
body {
counter-reset: page_number;
}
#page-number:after {
counter-increment: page_number;
content: "Page " counter(page_number);
}
Having something like
<p id='page-number'></p>
in the footer.
Browser: Firefox 19.0.2
More info: How can I count CSS page breaks for printed HTML?
Thank you Fran!
– matrixb0ss
Jan 3 at 14:00
add a comment |
This will display page numbers, but not the total number of pages:
footer {
position:fixed;
bottom:0;
left:0;
}
body {
counter-reset: page_number;
}
#page-number:after {
counter-increment: page_number;
content: "Page " counter(page_number);
}
Having something like
<p id='page-number'></p>
in the footer.
Browser: Firefox 19.0.2
More info: How can I count CSS page breaks for printed HTML?
Thank you Fran!
– matrixb0ss
Jan 3 at 14:00
add a comment |
This will display page numbers, but not the total number of pages:
footer {
position:fixed;
bottom:0;
left:0;
}
body {
counter-reset: page_number;
}
#page-number:after {
counter-increment: page_number;
content: "Page " counter(page_number);
}
Having something like
<p id='page-number'></p>
in the footer.
Browser: Firefox 19.0.2
More info: How can I count CSS page breaks for printed HTML?
This will display page numbers, but not the total number of pages:
footer {
position:fixed;
bottom:0;
left:0;
}
body {
counter-reset: page_number;
}
#page-number:after {
counter-increment: page_number;
content: "Page " counter(page_number);
}
Having something like
<p id='page-number'></p>
in the footer.
Browser: Firefox 19.0.2
More info: How can I count CSS page breaks for printed HTML?
answered Jan 3 at 13:48
Fran G SFran G S
712
712
Thank you Fran!
– matrixb0ss
Jan 3 at 14:00
add a comment |
Thank you Fran!
– matrixb0ss
Jan 3 at 14:00
Thank you Fran!
– matrixb0ss
Jan 3 at 14:00
Thank you Fran!
– matrixb0ss
Jan 3 at 14:00
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54023302%2fhow-to-implement-counter-of-pages%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Hello, and welcome to Stackoverflow. Please read stackoverflow.com/help/how-to-ask and stackoverflow.com/help/mcve . Please note that Stackoverflow is not a coding service, and we expect you to have done your research and come up with an attempt at solving your own task.
– maximelian1986
Jan 3 at 13:34