parent
5295f23b4b
commit
016e750308
|
@ -1,7 +1,7 @@
|
|||
import stickyMonitor from './lib/utils/sticky';
|
||||
|
||||
export default () => {
|
||||
stickyMonitor(document.querySelector('.js-diff-files-changed'));
|
||||
stickyMonitor(document.querySelector('.js-diff-files-changed'), 76);
|
||||
|
||||
$('.js-diff-stats-dropdown').glDropdown({
|
||||
filterable: true,
|
||||
|
|
|
@ -28,14 +28,10 @@ export const isSticky = (el, scrollY, stickyTop, insertPlaceholder) => {
|
|||
}
|
||||
};
|
||||
|
||||
export default (el, insertPlaceholder = true) => {
|
||||
export default (el, stickyTop, insertPlaceholder = true) => {
|
||||
if (!el) return;
|
||||
|
||||
const computedStyle = window.getComputedStyle(el);
|
||||
|
||||
if (!/sticky/.test(computedStyle.position)) return;
|
||||
|
||||
const stickyTop = parseInt(computedStyle.top, 10);
|
||||
if (typeof CSS === 'undefined' || !(CSS.supports('(position: -webkit-sticky) or (position: sticky)'))) return;
|
||||
|
||||
document.addEventListener('scroll', () => isSticky(el, window.scrollY, stickyTop, insertPlaceholder), {
|
||||
passive: true,
|
||||
|
|
Loading…
Reference in New Issue