Conditionally Load Js Script For Desktop Pc (not Touch Device) With Certain Width Only
On my website I use a JS for parallax scrolling. I want to conditionally load that JS only on Desktop PCs with >= 1025 px width. And I desperately need help with optimizing and
Solution 1:
Well you could use yepnope to load your JavaScript dynamically, and then use window.innerWidth to check the screen width. I'm not sure on checking specifically for a mobile device, unless you use browser user agent strings.
Post a Comment for "Conditionally Load Js Script For Desktop Pc (not Touch Device) With Certain Width Only"