看板 Ajax 關於我們 聯絡資訊
現在我正做一個手機版網頁頁面(非app) 問題是我從index.php點連結到content.php?tid=1時 第二頁<head>內的 $(document).ready(function(){ var orgH = $("img").height()/$("img").width() ; var checkOrientation = function(){ mode = Math.abs(window.orientation) == 90 ? 'landscape' : 'portrait'; if ( $.browser.opera ) { width = screen.width; height = screen.height; mode = width > height ? "landscape" : "portrait"; } if (mode == 'landscape') { // 等比縮放闊度 $("img").width("100%"); $("img").height(orgH*$("img").width()) ; } else { $("img").width("100%"); $("img").height(orgH*$("img").width()) ; } }; window.addEventListener("resize", checkOrientation, false); window.addEventListener("orientationchange", checkOrientation, false); setInterval(checkOrientation, 500); }); 的程式碼並沒有從一進這個頁面便執行 必須按重新整理一次,那這樣就沒意義了... 我只是想利用來做出大圖縮到符合手機畫面大小的比例的圖 請問我該如何讓他一次到位? (不可能叫閱讀者每轉一次頁面都按重新整理來讓圖縮成符合size) 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 182.239.101.204 ※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1449477348.A.A0D.html ※ 編輯: mydoc (182.239.101.204), 12/07/2015 16:40:42
jhunkyoiori: 包在resize裡,但是現在都用css3比較多 12/07 18:28