Browse Source

KERNEL-13199 feat: sticky布局支持同时吸顶和吸底

es6
zsmj 2 years ago
parent
commit
94fc4e6e5d
  1. 28
      src/core/wrapper/layout/sticky/sticky.horizontal.js
  2. 28
      src/core/wrapper/layout/sticky/sticky.vertical.js

28
src/core/wrapper/layout/sticky/sticky.horizontal.js

@ -21,13 +21,29 @@ BI.HorizontalStickyLayout = BI.inherit(BI.FlexHorizontalLayout, {
}
}
if (columnSize !== "fill") {
var firstItemFill = o.columnSize[0] === "fill" || o.items[0].width === "fill";
w.element.css({
position: "sticky",
zIndex: 1,
left: firstItemFill ? "" : 0,
right: firstItemFill ? 0 : ""
var fillIndex;
BI.count(0, o.items.length - 1, index => {
if (BI.isNotNull(fillIndex)) {
return;
}
if ((o.columnSize[index] === "fill" || o.items[index].width === "fill")) {
fillIndex = index;
}
});
if (fillIndex > i) {
w.element.css({
position: "sticky",
zIndex: 1,
left: 0,
});
} else {
w.element.css({
position: "sticky",
zIndex: 1,
right: 0
});
}
} else {
w.element.css({
overflow: ""

28
src/core/wrapper/layout/sticky/sticky.vertical.js

@ -21,13 +21,29 @@ BI.VerticalStickyLayout = BI.inherit(BI.FlexVerticalLayout, {
}
}
if (rowSize !== "fill") {
var firstItemFill = o.rowSize[0] === "fill" || o.items[0].height === "fill";
w.element.css({
position: "sticky",
zIndex: 1,
top: firstItemFill ? "" : 0,
bottom: firstItemFill ? 0 : ""
var fillIndex;
BI.count(0, o.items.length - 1, index => {
if (BI.isNotNull(fillIndex)) {
return;
}
if ((o.rowSize[index] === "fill" || o.items[index].height === "fill")) {
fillIndex = index;
}
});
if (fillIndex > i) {
w.element.css({
position: "sticky",
zIndex: 1,
top: 0,
});
} else {
w.element.css({
position: "sticky",
zIndex: 1,
bottom: 0
});
}
} else {
w.element.css({
overflow: ""

Loading…
Cancel
Save