I am using PagePiling in my project, specifically the option to add a menu.
Per the documentation you can simply add html:
<ul id="myMenu">
<li data-menuanchor="firstPage" class="active"><a href="#firstPage">First section</a></li>
<li data-menuanchor="secondPage"><a href="#secondPage">Second section</a></li>
<li data-menuanchor="thirdPage"><a href="#thirdPage">Third section</a></li>
<li data-menuanchor="fourthPage"><a href="#fourthPage">Fourth section</a></li>
</ul>
and within the js:
$('#pagepiling').pagepiling({
anchors: ['firstPage', 'secondPage', 'thirdPage', 'fourthPage', 'lastPage'],
menu: '#myMenu'
});
However, I want to add dynamic menu elements for instance:
<ul id="myMenu">
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li data-menuanchor="<?php sanitize_title(the_title()); ?>"><a href="#<?php sanitize_title(the_title()); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
How do I also update the options in the js?