Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions ietf/static/css/ietf.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1188,3 +1188,20 @@ blockquote {
padding-left: 1rem;
border-left: solid 1px var(--bs-body-color);
}

.overflow-shadows {
transition: box-shadow 0.5s;
}

.overflow-shadows--both {
box-shadow: inset 0px 21px 18px -20px var(--bs-body-color),
inset 0px -21px 18px -20px var(--bs-body-color);
}

.overflow-shadows--top-only {
box-shadow: inset 0px 21px 18px -20px var(--bs-body-color);
}

.overflow-shadows--bottom-only {
box-shadow: inset 0px -21px 18px -20px var(--bs-body-color);
}
25 changes: 24 additions & 1 deletion ietf/static/js/ietf.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,27 @@ $(document)
// });
});

function overflowShadows(el) {
function handleScroll(){
const canScrollUp = el.scrollTop > 0
const canScrollDown = el.offsetHeight + el.scrollTop < el.scrollHeight
el.classList.toggle("overflow-shadows--both", canScrollUp && canScrollDown)
el.classList.toggle("overflow-shadows--top-only", canScrollUp && !canScrollDown)
el.classList.toggle("overflow-shadows--bottom-only", !canScrollUp && canScrollDown)
}

el.addEventListener("scroll", handleScroll, {passive: true})
handleScroll()

const observer = new IntersectionObserver(handleScroll)
observer.observe(el) // el won't have scrollTop etc when hidden, so we need to recalculate when it's revealed

return () => {
el.removeEventListener("scroll", handleScroll)
observer.unobserve(el)
}
}

$(document)
.ready(function () {
// load data for the menu
Expand All @@ -108,7 +129,7 @@ $(document)
}
attachTo.find(".dropdown-menu")
.remove();
var menu = ['<ul class="dropdown-menu ms-n1 mt-n1">'];
var menu = ['<ul class="dropdown-menu ms-n1 mt-n1 overflow-shadows">'];
var groups = data[parentId];
var gtype = "";
for (var i = 0; i < groups.length; ++i) {
Expand All @@ -127,6 +148,8 @@ $(document)
attachTo.closest(".dropdown-menu");
}
attachTo.append(menu.join(""));

attachTo.find(".overflow-shadows").each(function(){ overflowShadows(this)})
}
}
});
Expand Down