나는 반응 형 사이트를 만들려고하고 현재 레이아웃에서 페이지 나누기가 어디에 있는지 알아야합니다. 그러면 각 창 크기를 조정하면서 현재 창 크기를 조정하는 내용을 생각하면됩니다. this 게시물에서 반응 형 레이아웃에 대해 이야기하는 사람을 봅니다. 기능에 대한 링크 here. 나는이 코드를 발견했으나 작동하지 않는다. 지금은 01:09이다. 여기서 밤은 브라질이고 메신저는 미친 듯하다. 누군가 나를 도울 수 있니? 크롬에서 임 테스트. 저자는 em의 페이지 구석에 현재 크기를 넣으라고 알려줍니다.media query debug
<html>
<head>
<title>MediaQuery DBG</title>
<SCRIPT LANGUAGE="JavaScript" SRC="http://code.jquery.com/jquery-1.6.4.js"></SCRIPT>
<script type="text/javascript">
$(document).ready(function() {
var step = 1;
var start = 1;
var end = 2048;
var unit = "em";
var command = "";
var expression = "";
for (cs=start;cs<=end;cs=cs+step)
{
expression = "screen and (min-device-width: "+(cs-step)+unit") and (max-device-width: "+(cs)+unit")";
command = "var mql = window.matchMedia("+expression+");" +
"function handleOrientationChange(mql) {" +
" if (mql.matches) {" +
" $(\"#lblmq\").replaceWith(\"<div id='lblmq'>tamanho: "+cs+"</div>\"); " +
" }" +
"}";
command = "mql.addListener("+command+");"
eval(command);
});
</script>
<style>
#lblmq
{
background-color: #789;
width:20em;
}
</style>
</head>
<body >
<div id='lblmq'></div>
</body>
</html>
왜 모든 곳에서 해시가 있습니까? '<#html#>'? – thirtydot
무엇이 작동하지 않습니까? –
@thirtydot 해시가 있기 때문에 내가 ctrl + k html 속성을 할 때까지 stackoverflow에 숨겨져 있습니다. $ (\ "# lblmq \")에는 정말 큰 소리가 있습니다. 고마워요 – newway