I have a series of jQuery scripts on my site that I want to only run if the users screen width is greater than 960px. I know that you can't detect screen size using php but is there a way to create something to this effect:
<? php
if [METHOD TO DETECT SCREEN SIZE] > 960px {
echo '<script src="js/nbw-parallax.js" type="text/javascript"></script>';
}
?>
Why not use jQuery?
if( $(window).width() > 960 )
{
$.ajax({
url: 'js/nbw-parallax.js',
dataType: "script",
success: function() {
//success
}
});
}