javascript - fullPage.js dynamical slides with ACF last slide -


i creating dynamic full page slider fullpage.js , advanced custom fields plugin wordpress.

 <div id="fullpage">     <?php if(get_field('slide')): ?>             <?php while(has_sub_field('slide')): ?>         <div class="section" id="home">                     <?php the_sub_field('slide_text'); ?>         </div>             <?php  endwhile; ?>     <?php endif; ?> </div> 

the slider has down-arrow show down movement , change up-arrow icon when reach last slide, this:

   if($(window).scrolltop() === 0) {         $('.ion-chevron-up').addclass('ion-chevron-down').removeclass('ion-chevron-up');    } else if($(window).scrolltop() + $(window).height() >= $(document).height() - 15) {         $('.ion-chevron-down').addclass('ion-chevron-up').removeclass('ion-chevron-down');       } else {      // nothing     } 

how can determine last slide of fullpage.js dynamically , achieve this?

edit

i ended using

.fp-viewing-1 .ion-chevron-down {   display: none; } .fp-viewing-0 .ion-chevron-up {   display: none; } 

although not dynamic since on client side there can slides added not solution. i'd need class fp-viewing-x last slide, whatever number be.

do not use scrolltop unless use scrollbar:true .(read fullpage.js faqs more info).

use instead callbacks provided plugin such afterload.

then check section active class last 1 like:

if ( $('.section.active').is(':last-child')) 

or can use class fp-viewing-xxx added body element site , deal css. (which option)


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -