1
我建立一個圖片瀏覽器和我的問題,我的代碼:調整圖像大小調整
$('.table_content_results table').click(function()
{
$('#overlay').show();
$('#pdfFrame').show();
$(window).resize();
});
$(window).resize(function()
{
var contentWidth = $('#pdfFrame').children('img').width();
var contentHeight = $('#pdfFrame').children('img').height();
var imageWidth = contentWidth/2;
var imageHeight = contentHeight/2;
$('#pdfFrame').children('img').width(imageWidth).height(imageHeight);
$('#pdfFrame').css(
{
position:'absolute',
left: ($(window).width() - imageWidth)/2,
top: ($(window).height() - imageHeight)/2
});
});
隨着劇本我農作物在div #pdfFrame圖像的大小。一個問題是,我每次調整窗口大小時,圖像作物都會變成50%。我的問題是如何防止這種反覆耕作。
它只需要通過第一次顯示圖像進行裁剪。
我希望有人能幫助我。
在此先感謝!
是你想要的圖像裁剪窗口達到一定的規模,因爲現在它要調整窗口 – Henesnarfel 2012-02-28 14:14:29
的任何變化。如果我們假設對負載調整而已,不調整,使用jQuery的負載後()不調整()? – adeneo 2012-02-28 14:15:39
是的,但pdfFrame需要有一個窗口的位置中心,這取決於圖像的大小。 – 2012-02-28 14:18:45