2012-03-25 3 views
0

내가 가지고있는 다음과 같은 기능 - 파이어 폭스에서 잘 작동 :IE가하여 onResize 발사

나는이 IE의 크기를 조정 몸에 불을 얻을 수있는 방법은?

function sizeColumnHeadings() { 
    var $headingsTable = $('#TopicPostList_hdiv > table').eq(0), 
     $rowsTable = $('#TopicPostList_div > table').eq(0); 

    if ($headingsTable.length && $rowsTable.length) { 
     $headingsTable.width($rowsTable.width()); 
    } 
} 




$(window).on('resize', function() { 
     sizeColumnHeadings(); 
    }).trigger('resize'); 

답변

0

jquery를 사용하는 경우 IE, Firefox 및 Chrome에서 다음 코드가 작동합니다.

var cnt = 0; 
// this is called when the document finishes loading (similar to onLoad in the body tag) 
$(function() { 
    // this asssigns a callback function each time the browser is resized 
    // it turns out that it is triggered multiple times on one resize 
    $(window).resize(function() { 
     cnt++; 
     // this code simply displays the # of times the callback is triggered 
     // I defined a <div id=show> in the body, and this updates its html. 
     $('#show').html('cnt = ' + cnt); 
    }); 
}); 

다른 브라우저 간의 비 호환성을 다루기 때문에 jquery를 사용하는 것이 좋습니다.