How to Disable Page Piling on Mobile?

1.1k Views Asked by At

I am using this page piling script on my website and I want to disable this page piling on mobile so how can o do this please suggest me

https://github.com/alvarotrigo/pagePiling.js

1

There are 1 best solutions below

0
On

Check the window.innerWidth and if it less than a specified pixel width don't apply the page piling.

Usage from the docs here

html

<div id="pagepiling">
    <div class="section">Some section</div>
    <div class="section">Some section</div>
    <div class="section">Some section</div>
    <div class="section">Some section</div>
</div>

javascript

$(document).ready(function() {
    $('#pagepiling').pagepiling();
});

With your modification.

$(document).ready(function() {
   if (window.innerWidth > 320) {
       $('#pagepiling').pagepiling();
   } else {
     // do something else or do nothing
   }
});