Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

plans: Use IntersectionObserver to handle subheaders.

Karl Stolley0290642f1d94
diff --git a/web/src/portico/landing-page.js b/web/src/portico/landing-page.js
index 134a4a2191b..4b70bcb41e3 100644
--- a/web/src/portico/landing-page.js
+++ b/web/src/portico/landing-page.js
@@ -164,6 +164,17 @@ $(() => {
// Set the correct values for span and colspan
$(".features-col-group").attr("span", plans_columns_count);
$(".subheader-filler").attr("colspan", plans_columns_count);
+
+ const observer = new IntersectionObserver(
+ ([entries]) => {
+ entries.target.classList.toggle("stuck", entries.intersectionRatio < 1);
+ },
+ {thresholds: [0.8], rootMargin: "-120px 0px 0px 0px"},
+ );
+
+ for (const subheader of document.querySelectorAll("td.subheader")) {
+ observer.observe(subheader);
+ }
}
}
});
diff --git a/web/styles/portico/comparison_table.css b/web/styles/portico/comparison_table.css
index 0f0e055362a..b6caea2e9e2 100644
--- a/web/styles/portico/comparison_table.css
+++ b/web/styles/portico/comparison_table.css
@@ -543,4 +543,50 @@
.comparison-table th .icon {
display: revert;
}
+
+ .comparison-table th {
+ vertical-align: top;
+ }
+
+ .comparison-table th.comparison-table-feature {
+ padding-top: 28px;
+ }
+
+ .comparison-table td.stuck {
+ padding-top: 28px;
+ }
+
+ @media (width <= 730px) {
+ .comparison-table th {
+ padding: 8px 2px;
+ }
+
+ .comparison-table th.comparison-table-feature {
+ padding-top: 24px;
+ padding-left: 14px;
+ }
+
+ .comparison-table td.subheader.comparison-table-feature {
+ /* Line up features with plan titles. */
+ line-height: 18px;
+ }
+
+ .comparison-table td.stuck {
+ padding-top: 24px;
+ vertical-align: top;
+ }
+ }
+
+ @media (width <= 684px) {
+ .comparison-table td.stuck {
+ height: 60px;
+ }
+ }
+
+ @media (width <= 500px) {
+ .comparison-table td.subheader.comparison-table-feature {
+ /* Line up features with plan titles. */
+ line-height: 14px;
+ }
+ }
}