2013-01-22 3 views
1

$(window).resize가 작동하지 않습니다. 무엇이 없습니까?

그래서이 페이지는 가로로 가운데에 350px 크기의 단일 수직 메뉴가 있습니다. 링크는 다른 콘텐츠를 표시하는 iframe을 엽니 다. 외부 사이트를 표시하는 iframe의 너비는 $("#iframeweb").width($(document).width() - $('#menu').width())이므로 화면을 채우고 메뉴를 옆으로 밀면됩니다.

그 부분은 작동하지만, 그것은 또한 윈도우의 크기 조정의 폭을 변경해야하지만 아무것도하지 않는 ...

코드 :

<div id="wrapper"> 
    <div id="outer"> 
    <div id="inner"> 
     <iframe name="iframeweb" id="iframeweb"></iframe> 
     <div id="menu"> 
       </div> 
     <iframe name="iframeA4" id="iframeA4"></iframe> 
    </div> 
    </div> 
    </div> 

<script type="text/javascript"> 
$(window).resize(function() { 
    $("#iframeweb").width($(document).width() - $('#menu').width()); 
}; 
</script> 

<script type="text/javascript"> 
$("#linkA4").click(function(){ 
    $("#iframeA4") 
     .hide('fast') 
     .animate({"width": "0px"}, 'fast') 
     .animate({"width": "210mm"}, 'fast') 
     .show('fast'); 
    $("#iframeweb").hide('fast'); 
}); 

$("#linkweb").click(function(){ 
    $("#iframeA4") 
     .animate({"width": "0px"}, 'fast') 
     .hide('fast'); 
    $("#iframeweb") 
     .hide('fast') 
     .width($(document).width() - $('#menu').width()) 
     .show('fast'); 
}); 
</script> 

답변

5

당신은 간단한 구문 오류를 가지고, 괄호 닫음

$(window).resize(function() { 
    $("#iframeweb").width($(document).width() - $('#menu').width()); 
}); // <-- 
+0

간단! 어쩌면 잠시 쉬는 시간 일 수도 있습니다 ... – ThomasCS

+0

: -P Console/Inspect Element는 JS를 할 때마다 최고의 신디 오류입니다. – Bryan