Freeze box or action button

Hello everyone, as you can see the image I want to freeze that action button box so that when someone scroll down the page they won’t have to scroll up for the action button. I want to freeze the action button or the whole box marked in the screenshot.

Thank you

Please apply it.

frappe.ui.form.on('Purchase Invoice', {
    refresh: function(frm) {
        setTimeout(function() {
            var targetDiv = $(".page-head.flex");
            targetDiv.css({
                zIndex: '1020',
            });
        }, 100);
    }
});

Output:

3 Likes

Nice solution. Why do we need a timer for that?

Thanks :grinning:

Adding a delay ensures the CSS is applied after the elements are rendered but you can also use without setTimeout the onload_post_render instead of the refresh.

frappe.ui.form.on('Purchase Invoice', {
    onload_post_render: function(frm) {
        var targetDiv = $(".page-head.flex");
        targetDiv.css({
            zIndex: '1020',
        });
    }
});
1 Like

Really nice trick.

Hi, @NCP

Just like the above script i want to freeze this left sidebar too.
can you check and help.

Thank You

Reference: