mirror of https://github.com/zulip/zulip.git
plans: Use IntersectionObserver to handle subheaders.
This commit is contained in:
parent
7ea313c658
commit
0290642f1d
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue