If mobile disable certain scripts
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
// what you want to run in mobile
}
you can do something like this to test if it is a mobile.
if you are only concerned with the width :
if ($(window).width() <= 479) {
do stuff
}
or you can use this package.
Use following
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code..
}else
{
//Now include js files
}
for your second Question
use
if (window.width > 479) {
$('head').append('<link rel="stylesheet" href="style2.css" type="text/css" />');
}
here you can include css or js file.