作者共發了1篇帖子。
字體大小:較小 - 100% (默認)  內容轉換:不轉換
 
點擊 回復
627 0
【代码】javascript按比例缩小图片
产品的注销
初入江湖 七級
回復
1樓 發表於:2010-12-19 10:57
function qmd_size(that){
 var new_width=436;
 var new_height=200;
 var src_width=that.width;
 var src_height=that.height;
 if (src_width>new_width || src_height>new_height){
  var radio=Math.max((src_width/new_width),(src_height/new_height));
  var width=Math.ceil(src_width/radio);
  var height=Math.ceil(src_height/radio);
  that.width=width;
  that.height=height;
 }return{
  width:width, //宽
  height:height //高
 }
}
回覆帖子
內容:
用戶名: 您目前是匿名發表。
驗證碼:
看不清?換一張
(快捷鍵:Ctrl+Enter)
本帖信息
點擊數:627 回複數:0
作者:产品的注销
最後回覆:产品的注销
最後回復時間:2010-12-19 10:57
本吧熱門帖子
本吧精品帖子
公告板