- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Responsive web design and javascript
what is the best way to load JavaScript files conditionally based on resolution…?
I should check for both page loading and browser resizing…
Why would you do that?
Why not use the same code for desktop and smaller screens?
Why not use the same code for desktop and smaller screens?
I agree it’s probably not a huge issue but there MIGHT be JS that applies at smaller screen sizes but NOT at desktop size….or vice versa.
Sliders come to mind.
@Sedana… below are two of my scenarios where I felt the need..
ONE : I need to show google map in desktop version and tablet version, but not on mobile version. loading google map API and associated jquery plugin Im using will increase page load time on mobile, so I want to conditionally load it for resolutions greater than 480px..
TWO: I have a sidebar, which will be sticky in desktop version and will be fixed to bottom in mobile and tablet versions. I am using a script for sticky sidebar, which I do not want to load in mobile and desktop versions..