So I am loading in different javascript depending on the screen width. The script is simple and works fine and loads the appropriate script depending on screen width. The problem is it only loads in the script depending on the original screen width. If i change my screen width to be smaller it doesn't change unless i refresh the page.
Anybody know of a simple fix? I am still pretty nooby with javascript.
Thanks!
Code im using:
if ( $(window).width() > 1280) {
//Add your JavaScript for large screens here
}
else if( $(window).width() > 768) {
//Add your JavaScript for medium screens here
}
else ( $(window).width() > 439) {
//Add your JavaScript for small screens here
}
Question
PortalPacific
So I am loading in different javascript depending on the screen width. The script is simple and works fine and loads the appropriate script depending on screen width. The problem is it only loads in the script depending on the original screen width. If i change my screen width to be smaller it doesn't change unless i refresh the page.
Anybody know of a simple fix? I am still pretty nooby with javascript.
Thanks!
Code im using:
Link to comment
Share on other sites
14 answers to this question
Recommended Posts