View | Details | Raw Unified | Return to bug 38899
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-4 / +8 lines)
Lines 75-91 function togglePanel(node) { Link Here
75
    }
75
    }
76
}
76
}
77
77
78
$(document).ready(function () {
78
function apply_sticky(nodes) {
79
    //check if sticky element is stuck, if so add floating class
79
    if (nodes) {
80
    if ($(".sticky").length) {
81
        const observer = new IntersectionObserver(
80
        const observer = new IntersectionObserver(
82
            ([e]) =>
81
            ([e]) =>
83
                e.target.classList.toggle("floating", e.intersectionRatio < 1),
82
                e.target.classList.toggle("floating", e.intersectionRatio < 1),
84
            { threshold: [1] }
83
            { threshold: [1] }
85
        );
84
        );
86
85
87
        observer.observe(document.querySelector(".sticky"));
86
        observer.observe(nodes);
88
    }
87
    }
88
}
89
90
$(document).ready(function () {
91
    //check if sticky element is stuck, if so add floating class
92
    apply_sticky(document.querySelector(".sticky"));
89
93
90
    //check for a hash before setting focus
94
    //check for a hash before setting focus
91
    let hash = window.location.hash;
95
    let hash = window.location.hash;
(-)a/koha-tmpl/intranet-tmpl/prog/js/vue/components/Toolbar.vue (-10 / +2 lines)
Lines 22-38 export default { Link Here
22
            observer: null,
22
            observer: null,
23
        };
23
        };
24
    },
24
    },
25
    methods: {
25
    methods: {},
26
        stickyToolbar([e]) {
27
            e.target.classList.toggle("floating", e.intersectionRatio < 1);
28
        },
29
    },
30
    mounted() {
26
    mounted() {
31
        if (this.sticky) {
27
        if (this.sticky) {
32
            this.observer = new IntersectionObserver(this.stickyToolbar, {
28
            apply_sticky(this.$refs.toolbar);
33
                threshold: [1],
34
            });
35
            this.observer.observe(this.$refs.toolbar);
36
        }
29
        }
37
    },
30
    },
38
};
31
};
39
- 

Return to bug 38899