我想知道如何为我的移动设备导入特定的JS脚本......
这样的事情:
</html>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<link href="stylesheets/bottom.css" media="screen, projection" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="components/normalize-css/normalize.css">
<link href="stylesheets/app.css" media="screen, projection" rel="stylesheet" type="text/css" />
</head>
<body>
// Only for media screen and (max-width : 500px)
<script src="modile.js"></script>
</body>
</html>
答案 0 :(得分:0)
您可以这样做:
<script>
if (window.screen.width <= 560) {
// load the script you need
} else {
// load another script
}
</script>
您可以使用jQuery getScript加载脚本,例如;