使用外掛程式

getResponsiveLayout 函數會使用以下引數:

  • ppw (必要,整數):頁面從手機直向配置切換為手機橫向配置之前,瀏覽器視窗的最大像素寬度
  • plw (必要,整數):頁面從手機橫向配置切換為平板電腦配置之前,瀏覽器視窗的最大像素寬度
  • tw (必要,整數):頁面從平板電腦版面切換為桌上型電腦版面之前,瀏覽器視窗的最大像素寬度

呼叫此函數所傳回的字串會包含冒號 (:) 分隔的兩個部分。 此字串的第一個部分包含下列其中一個值,視瀏覽器的寬度和上述引數而定:

  • "phone portrait layout"
  • "phone landscape layout"
  • "phone layout" (適用於並非直向和橫向配置均具備的網站)
  • "tablet layout"
  • "desktop layout"

傳回字串的第二部分是瀏覽器的寬度和高度。 例如,"desktop layout:1243x700"。

範例

// A visitor accesses your site on their laptop. The browser window is maximized.
// * Your site switches from phone portrait mode to phone landscape mode when the browser width is greater than 500 pixels
// * Your site switches from phone landscape mode to tablet mode when the browser width is greater than 700 pixels
// * Your site switches from tablet mode to desktop mode when the browser width is greater than 1000 pixels
// Sets eVar10 to "desktop layout:1920x937".
s.eVar10 = getResponsiveLayout(500, 700, 1000);

// A visitor accesses your site on their phone.
// * Your site has only a phone mode, a tablet mode, and a desktop mode
// * Your site switches from phone mode to tablet mode when the browser width is greater than 800 pixels
// * Your site switches from tablet mode to desktop mode when the browser width is greater than 1,100 pixels
// Sets eVar10 to "phone portrait layout:720x1280"
s.eVar10 = getResponsiveLayout(800, 800, 1100);

版本記錄

1.1 (2021 年 3 月 19 日)

  • 將版本編號加入為內容資料。

1.0 (2018 年 5 月 2 日)

  • 首次發行。
自動翻譯
使用「語言選取器」檢視此頁面的英文版。
翻譯是否有幫助?

Ask AI

Not sure where to start?
Ask me anything about Adobe products.

Type your question or pick a suggestion below.

Use of this AI chatbot is subject to Adobe's Privacy Policy. Don't share sensitive data. AI responses are not your Content, may be inaccurate, and any offers provided are non-binding. Generative AI Terms.