나는 Modernizr.mq를 테스트하기 위해 다음 코드를 시도했으며 yep
에 대한 js 코드를로드하려고합니다.Modernizr.load는 yep 및 nope 경고를 모두 표시합니다.
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>S123</title>
<link rel="stylesheet" href="css/s.css" />
<script src="js/modernizr.com.js"></script>
</head>
<body>
<script>
Modernizr.load({
test: Modernizr.mq,
yep : alert("hello, beautiful"),
nope: alert("very poor choice of words"),
});
</script>
</body>
</html>
그러나 그것은 나에게 모두 yep
및 nope
경고를 제공합니다.
내가 테스트 코드 (아래) 잘 작동 왜, 아무 생각이
if (Modernizr.mq("only screen and (min-width:480px)")) {
alert("hello");
};
누군가가 내가 뭘 잘못 말해 줄래?
fosfo에 대한 의견을 보내 주셔서 감사합니다. 화면 크기가 480px보다 큰 경우 JS 코드를 추가하고 싶습니다. 어떻게 구현할 수 있습니까? – s11
에서 jquery 크기 조정에 대한 자세한 내용을 볼 수 있습니다. http://api.jquery.com/resize/ – fosfo