There are two ways: server-side or client-side.
Server-side
Depends heavily on language. Some already have well established libraries for client detection from the HTTP request header. If your pages are dynamically generated, a good approach would be to provide a version without the script declaration.
Client-side
If your pages are statically served (ie plain HTML), the best option is to serve them without calling the script. You can then detect through a small custom script if the browser is mobile; if it is not, dynamically add the skrollr.js script.
As , exactly, you will detect if the mobile browser is your choice; you can use ready-made libraries, detect keywords in userAgent
, or use services like link .
I'd like to remind you that detection by size is not always a good idea; tablets and some laptops have high resolution E touchscreen interactivity, which can thwart your plans. Still, I have mentioned only methods that work crossbrowser; as you have already mentioned, media query and some other new technologies can be used as well, but at the cost of not working in legacy browsers.
I hope I have helped!