title: Fullpage.js - Prevent scroll
body: <p>I have set up fullpage.js but want the functionality of being able to scroll to a section and if certain conditions are met to show new elements within the same section on the next scroll. This next scroll should not proceed to the next section.</p>
  
  <p>Using the callbacks I have been able to determine when a section does need this second scroll. From the documentation I have even been able to cancel the scroll before it takes place and therefore allow the new elements to be shown without going to the next section. The problem is allowing it to move to the next section after that. I either get it to stop the scroll but no longer be able to scroll again or the text appears as it scrolls to the next section since any kind of flag can change and on the next scroll fires multiple times so it moves right off the section.</p>
  
  <pre><code>        //HTML - typical fullpage.js section
  
          &lt;div class="section"&gt;
              &lt;div&gt;
                  &lt;h1&gt;Default Text&lt;/h1&gt;
                  &lt;p class="hidden-text"&gt;Additonal text to appear on second scroll&lt;/p&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="section"&gt;
              &lt;div&gt;
                  &lt;h1&gt;Next Section&lt;/h1&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          //fullpage.js - the callbacks being used
  
          afterLoad: function(anchorLink, index){
              preventScroll = false;
              if(this.has(".hidden-text").length){
                  preventScroll = true;
              }
          },
          onLeave: function(index, nextIndex, direction){
              if (preventScroll &amp;&amp; direction == "down") { 
                  this.find('.hidden-text').addClass('animate-text');
                  this.find('.hidden-text').removeClass('hidden-text');
                  return false;
              }
          },
  </code></pre>
  
  <p>Codepen found here : <a href="http://codepen.io/anon/pen/oxEexY" rel="nofollow">http://codepen.io/anon/pen/oxEexY</a></p>