How to implement counter of pages?












0















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.










share|improve this question




















  • 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
















0















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.










share|improve this question




















  • 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














0












0








0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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














  • 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












1 Answer
1






active

oldest

votes


















1














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?






share|improve this answer
























  • Thank you Fran!

    – matrixb0ss
    Jan 3 at 14:00












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
});


}
});














draft saved

draft discarded


















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









1














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?






share|improve this answer
























  • Thank you Fran!

    – matrixb0ss
    Jan 3 at 14:00
















1














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?






share|improve this answer
























  • Thank you Fran!

    – matrixb0ss
    Jan 3 at 14:00














1












1








1







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?






share|improve this answer













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?







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 3 at 13:48









Fran G SFran G S

712




712













  • 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





Thank you Fran!

– matrixb0ss
Jan 3 at 14:00




















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Mossoró

Error while reading .h5 file using the rhdf5 package in R

Pushsharp Apns notification error: 'InvalidToken'