Viewport: How to get viewport size.
jQuery(window).width() uses document.documentElement.clientWidth and is regarded as cross-browser compatible. Directly using .clientWidth is faster and equally compatible. The tables below compare these live against the inner/outer methods to determine the most accurate method: verge wins because itnormalizes browser nuances to accurately match @media breakpoints.
| width methods | live output |
|---|---|
| @media breakpoint | 1920 |
| verge.viewportW() | 1920 |
| $(window).width() | 1903 |
| document.documentElement.clientWidth | 1903 |
| window.innerWidth | 1920 |
| window.outerWidth | 1920 |
| height methods | live output |
|---|---|
| @media breakpoint | 989 |
| verge.viewportH() | 989 |
| $(window).height() | 989 |
| document.documentElement.clientHeight | 989 |
| window.innerHeight | 989 |
| window.outerHeight | 1050 |
Device: How to get device size.
Use window.screen.width for device width and window.screen.height for device height..availWidth and .availHeight give you the device size minus UI taskbars. (Try on an iPhone.) Device size is static and does not change when the page is resized or rotated.
| width methods | live output |
|---|---|
| @media breakpoint | 1920 |
| window.screen.width | 1920 |
| window.screen.availWidth | 1920 |
| height methods | live output |
|---|---|
| @media breakpoint | 1080 |
| window.screen.height | 1080 |
| window.screen.availHeight | 1050 |
Document: How to get document size.
Document size methods are often needed in scrolling apps. Note the difference between jQuery(document).width() and the native properties (especially when the window is wider than the max-width of the body). jQuery uses the Math.max of 5 numbers to calculate this. For decent cross-browser support, the Math.max of the 3 document.documentElement properties seems to suffice.
| width methods | live output |
|---|---|
| $(document).width() | 1903 |
| document.body.clientWidth | 1080 |
| document.body.offsetWidth | 1080 |
| document.body.scrollWidth | 1903 |
| document.documentElement.clientWidth | 1903 |
| document.documentElement.offsetWidth | 1903 |
| document.documentElement.scrollWidth | 1903 |
精選專案.企業形象網站.Line OA / 休閒餐飲類
網站技術:PHP/MySql
達日好胖卡推出點數及票劵LINE官方帳號喔,功能有點數集點/兌換/轉讓,甚至也有票劵功能,像是餐劵、遊戲劵等等。適用於公司、學校與社區活動,便利性極高的LINE OA 官方帳號。
精選專案.網頁設計.RWD響應式網站.企業形象網站 / 休閒餐飲類
網站技術:PHP . Javascript/MySql
丹醇用最新鮮的原料製作最安心的商品,追求吃進身體裡面的食物與飲品都是健康、安全、無負擔。 網站主打線上訂購乳製品,簡易的下定流程,對於第一次使用的會員也不是問題,也能配合指定的時間抵達喔。
精選專案.網頁設計.RWD響應式網站 / 農林漁牧類
網站技術:Javascript
響應式(RWD)網頁設計,設計UI/UX使用者體驗,可於各種裝置進行網頁瀏覽(PC、平板、手機)。
傑立資訊事業有限公司電話:(02)2739-9096 | 傳真:(02)2739-6637 | 客服:[email protected] | 臺北市信義區和平東路3段257號6樓map
© 2019 傑立資訊 All rights reserved.| 網站隱私政策