")這裡是建立一個暫時的img標簽,相似js建立一個new Image()對象! $("").attr("src", $(img).attr("src")).load(function() { realWidth = this.width; realHeight = this.height; //若是真實的寬度大於閱讀器的寬度就依照100%顯示 if(realWidth>=_w){ $(img).css("width","100%").css("height","auto"); $(img).attr("width","100%")//$(img).attr("height","100%");//$(img).css("height",_w+'px'); } else{//若是1995澳门论坛资料大全19小於閱讀器的寬度依照原尺寸顯示 $(img).attr("width","100%")//$(img).attr("height","100%");//$(img).css("height",realWidth+'px'); } }); }); });