I’m hoping someone can help me…
I am using Alvaro Trigo’s Fullpage.js and Elliot Condon’s ACF Flexible field within a WordPress site I’m developing.
For each flexible field entry I declare a new section / page within Fullpage. The client would like a counter fixed to the bottom of the page, which reads 1/10, 2/10, 3/10 etc.
I am able to count the total number of fields, using
<?php echo count( get_field('content') ); ?>
However, I am unsure how to update each number every time the slide changes. Can I do this with PHP or is a JS solution needed?
Thank you in advance â Any help will be much appreciated! Please let me know if you need any more information.
You should go for Javascript for that.
Use the callbacks fullpage.js provides such as
afterLoad
to update the number based on the section index which you can extract from theafterLoad
function params.Something like this:
Having a counter element like this: