-
- 15 Posts
I am using Foundation based templates and want to have chunk1 loaded if the website is viewed on screens <768px and chunk2 if the screen size is >768px.
The reason is that I only want the Magellan js loaded if the screen size is <768px and try to achieve this by using a footer with the js - chunk1 - and another without the js - chunk2.
Any thought how to do this?
-
- 24,544 Posts
There's no easy way to get the screen size on the server side (e.g., in PHP). The browser knows, but it has no way of telling MODX, short of a really tricky Ajax call that somehow identifies which user it's coming from.
This page may provide clues on how to do it with JavaScript:
https://responsivedesign.is/develop/javascript/conditionally-load-javascript-based-on-media-query
-
- 15 Posts
Thanks for your help Bob. Will look into it.