Zanic L3
Zanic L3

Reputation: 1088

Fullpage.js disable on mobile/below given pixels?

https://alvarotrigo.com/fullPage/

I've tried code like this but that doesn't work sadly. I want to disable it after 976px for mobile users.

<script>
if (screen && screen.width > 768) {
document.write('<script type="text/javascript" src="http://your-file-path/fullpage.js"><\/script>');
}
</script>

Upvotes: 2

Views: 899

Answers (2)

Georgy
Georgy

Reputation: 11

You need to add the following code after the one you are using, e.g.:

<script>
 if (screen && screen.width > 768) {
  document.write('<script type="text/javascript" src="http://your-file-path/fullpage.js"><\/script>');
 }
</script>

<script>
 $(document).ready(function() {
  $('#fullpage').fullpage();
 });
</script>

This script is especially useful if your are using Webflow since sometimes script won’t work as intended without firing them first.

I had the same situation, but the script above worked for me!

Upvotes: 0

Alvaro
Alvaro

Reputation: 41595

Just use the responsiveWidth or responsiveHeight option combined with fp-auto-height-responsive.

Read more about all of those options in the fullPage.js docs or see this codepen.

Upvotes: 2

Related Questions