
內容簡介
這是一個相當簡單的外掛,可將在手機螢幕上過寬的表格折疊成三種「堆疊式」檢視之一。
這個外掛的主要功能是來自 John Polacek 的 jQuery Stacktable 外掛,你可以在這邊查看:
http://johnpolacek.github.io/stacktable.js/
我對 jQuery Stacktable 外掛並無任何功勞,全部功勞歸於 John!
這個 WordPress 外掛的全部功能只是在你指定的頁面排列 Stacktable 腳本,然後使用一小段 javascript 在你選擇的所有頁面上套用 Stacktable 腳本。你也可以停用內建的 CSS 範例,以便放置你自己的 CSS 樣式在主題中,以指定你自己的行動裝置斷點和任何其他修改。
版本 1.0.0 新增了在任何頁面上使用簡碼排列腳本的功能。你可以指定 type 和 class 屬性,以及 head index 和 show header 屬性。
「type」屬性可以是三種顯示類型中的一種:stacktable、cardtable、stackcolumns。預設檢視是 stacktable。
「class」屬性允許你為手機檢視周圍的包裝 div 指定一個類別,以使你更輕鬆地進一步調整 CSS。
「headindex」屬性允許你指定表頭行索引 (從 0 開始),以防表頭行不是表格的第一行。
「showheader」屬性可以有 「yes」或「no」的值,預設值是「yes」。這用於指定是否要在使用預設的 stacktable 顯示類型時顯示標題 (不用於其他兩種顯示類型)。
使用默認選項的簡碼為:[stacktable]
完整簡碼範例:[stacktable type="cardtable" class="myClass" headindex="0" showheader="yes"]
請注意,當螢幕寬度大於在 CSS 中指定的行動裝置斷點時,此外掛將對表格沒有影響。
功能:
使用 John Polacek 的 jQuery Stacktable 外掛修改表格,以使它們在行動裝置上顯示得很好。
選擇要在哪些頁面上排列腳本。它會套用到那些頁面上的所有表格。
在版本 1.0.0 中,你也可以在任何頁面上使用「stacktable」簡碼來排列 stacktable 腳本,以及指定你想要使用的三種顯示選項之一:stacktable (預設)、cardtable、stackcolumns。
可以停用內建 CSS,以便排列你自己的 CSS 樣式並設定你自己的行動裝置斷點。
附加資訊
這個外掛的主要功能是來自 John Polacek 的 jQuery Stacktable 外掛,你可以在這邊查看:
http://johnpolacek.github.io/stacktable.js/
我創建這個外掛的初始版本是為了使用在我開發的 Volunteer Sign Up Sheets 外掛產生的表格上:https://wordpress.org/plugins/pta-volunteer-sign-up-sheets/,但它被設計地足夠通用,以便可用於 WordPress 網站上的任何表格。針對 WordPress.org 發佈,我增加了一個管理設定頁面,以允許你選擇 Stacktable 腳本中排列的頁面,以及允許你停用檢視的內建 CSS 範例 (也可以停用行動裝置斷點)。
由於我對提供大部分顯示功能的主要 jQuery Stacktable 外掛沒有任何掌控權,所以我將無法支援你在腳本上遇到的任何問題。
外掛標籤
開發者團隊
原文外掛簡介
This is a fairly simple plugin that will collapse tables that are too wide for mobile screens into one of three “stacked” views.
The main functionality of this plugin is provided by the jQuery Stacktable plugin from John Polacek, which you can view here:
http://johnpolacek.github.io/stacktable.js/
I take no credit for the jQuery Stacktable plugin. That’s all John!
All this WordPress plugin does is enqueue the Stacktable script on the pages you specify in the settings, and then uses a very small piece of javascript to apply the Stacktable script to ALL tables on the pages you select. You can also disable the built-in sample CSS, so that you can put your own CSS for Stacktable in your theme in order to specify your own mobile breakpoint and any other modifications you wish to make.
Version 1.0.0 adds the ability to use a shortcode on any page to queue up the script. You can specify a type and class attribute, as well as head index and show header attributes.
The “type” attribute can one of the 3 display types: stacktable, cardtable, stackcolumns. Default view is stacktable.
The “class” attribute allows you to specify a class for the wrapper div around the mobile view so you can further tweak the CSS more easily.
The “headindex” attribute allows you to specify the header row index (starting from 0), in case your header row is not the first row of the table.
The “showheader” attribute can have values of “yes” or “no”, with “yes” being the default. This is used to specify if you want to show the headers when using the default stacktable display type (not used for the other 2 display types).
The shortcode to use with default options is simply: [stacktable]
Full Shortcode example: [stacktable type="cardtable" class="myClass" headindex="0" showheader="yes"]
Note that this plugin will have no effect on tables when the screen width is above the mobile breakpoint specified in the CSS.
Features:
Modifies tables to display nicely on mobile devices using the jQuery Stacktable plugin from John Polacek.
Select the specific pages you want the script to be enqueued on. It will be applied to all tables on those pages.
Alternately, in version 1.0.0, you can use the ‘stacktable’ shortcode on any page to queue up the stacktable script on that specific page as well as specify which of the 3 display options you want to use: stacktable (default), cardtable, stackcolumns
Can disable the built-in CSS so that you can queue up your own CSS styles and set your own mobile breakpoint
Additional Info
The main functionality of this plugin is provided by the jQuery Stacktable plugin from John Polacek, which you can view here:
http://johnpolacek.github.io/stacktable.js/
I created the initial version of this plugin to use for the tables generated by my Volunteer Sign Up Sheets plugin: https://wordpress.org/plugins/pta-volunteer-sign-up-sheets/, but made it generic enough that it could be used for any tables on a WordPress site. For the WordPress.org release I added an admin settings page to allow you to choose the pages the Stacktable script is enqueued on, and to allow you to disable the sample built-in CSS for the mobile view of the tables (as well as the mobile breakpoint).
Since I did NOT have anything to do with the main jQuery Stacktable plugin that provides the majority of the display functionality, I will not be able to provide support for any issues you have with the script.
