1
我一直在尋找這個插件http://benalman.com/code/projects/jquery-resize/examples/resize/,並可以使它正常工作,用於顯示窗口的尺寸的例子。jQuery的調整大小插件的div
我想顯示特定div的尺寸,當我嘗試這樣做時,頁面加載時會顯示尺寸,但不會因爲div通過更改瀏覽器窗口來調整尺寸而更改尺寸。
我使用這個代碼:
// Bind the resize event. When the window size changes, update its corresponding
// info div.
$('.main').resize(function(){
var elem = $(this);
// Update the info div width and height
$('#main-dim').text('Main, width: ' + elem.width() + ', height: ' + elem.height());
});
// Updates the info div immediately.
$('.main').resize();
});
.main
是我想要得到的尺寸股利,#main-dim
是div中顯示的尺寸
誰能告訴我。我在這裏做錯了什麼?
謝謝!