0

I have a script (https://github.com/SubZane/flyPanels) that should only be executed on small devices.

The script is called by:

<script>
document.addEventListener("DOMContentLoaded", function(event) {
    FastClick.attach(document.body);
    flyPanels.init({
            treeMenu: {
                init: true
            },
            search: {
                init: true,
                saveQueryCookie: true
            }
    })
});

</script>

How do i achieve this?

ManoDestra
  • 6,325
  • 6
  • 26
  • 50
wini
  • 43
  • 4
  • 1
    Possible duplicate of [How to identify screen size](http://stackoverflow.com/questions/12195371/how-to-identify-screen-size) – Roy Falk May 16 '16 at 18:30

1 Answers1

0

Refer this link

So basically you can check by an if statement like

if(screen.width == 768){
    //your code here

}

...and then have your event code under it. Just inquire about the screen size you want your code to work and check for that. PS: the screen object of js has specs in px....so make sure to check in px.

Avijeet Ghosh
  • 167
  • 1
  • 8