tag:blogger.com,1999:blog-7483265378974822546.post2579223528680523399..comments2023-03-19T23:16:59.847+08:00Comments on Pacess Laboratory: 支援 Retina 的網頁Pacesshttp://www.blogger.com/profile/06132943565155241514noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-7483265378974822546.post-44746473247253773492013-11-21T20:59:03.524+08:002013-11-21T20:59:03.524+08:00c.quet,謝謝指教~c.quet,謝謝指教~Pacesshttps://www.blogger.com/profile/06132943565155241514noreply@blogger.comtag:blogger.com,1999:blog-7483265378974822546.post-71570802053261307542013-11-21T18:43:22.785+08:002013-11-21T18:43:22.785+08:00那個 img tag 裡應該沒有 width 和 height 的 attribute 吧, 如果用...那個 img tag 裡應該沒有 width 和 height 的 attribute 吧, 如果用在有 width 和 height 的 img 就會變形了。<br />解法是先在 onload function 定義好 img 的 width 和 height:<br /><br />imgObject.onload = function() {<br /> this.width = this.width;<br /> this.height = this.height;<br /> this.width = this.width / 2;<br /> this.height = this.height / 2;<br />};<br /><br />這樣 resize 的 logic 就不會怪怪的。Jachttps://www.blogger.com/profile/12932976939224178413noreply@blogger.com