Hi,
I'm using ajax to load page content.
When an new page loads I'm getting the following console error:
fullPage: Fullpage.js can only be initialized once and you are doing it multiple times!
OK - can't see how to test if fullpage has already been initialised.
My setup code that is being executed each page load looks like:
$( '#fullpage' ).fullpage({ ...options });
If I call the destroy or rebuild methods before the init I get the console error:
TypeError: e.fn.fullpage.destroy is not a function
Help please!
Cheers
James
OK. I realised that fullpage adds fp-enabled class to HTML element, so I'm testing using:
if ( $( 'html' ).hasClass( 'fp-enabled' ) ) {
$.fn.fullpage.destroy();
}
Which works!
Check the docs for the state classes
The class
fp-enabledis added to the html element when fullpage.js is enabled. (and removed when destroyed).
Most helpful comment
OK. I realised that fullpage adds
fp-enabledclass to HTML element, so I'm testing using:Which works!