almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Sticky header with hours #3435

Open deniz946 opened 7 years ago

deniz946 commented 7 years ago

Hello, I'm using the timeline for workshift for employees, and my employees(groups) are so many, so the vertical scroll get's really big, and when im trying to put items to the lower employees I can't see the header with the hours, is there any way to stick the header or some items so the scroll don't affect it? Thanks you!

jmoraltu commented 7 years ago

This would be a nice feature, I tried some implementations but didn't work, I am interested if any solution can help!

-- Joan Morales

El 11 sept 2017, a las 13:22, Fridox notifications@github.com escribió:

Hello, I'm using the timeline for workshift for employees, and my employees(groups) are so many, so the vertical scroll get's really big, and when im trying to put items to the lower employees I can't see the header with the hours, is there any way to stick the header or some items so the scroll don't affect it? Thanks you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

deniz946 commented 7 years ago

Got a hack to make it work more or less with this, if it is useful to someone else :)

.vis-panel.vis-top{
    top:0!important;
    width:100%!important;
    z-index:100!important;
}

and

<script>
    $(document).ready(function () {
        $(window).scroll(function (e) {
            var $el = $('.vis-panel.vis-top');
            var isPositionFixed = ($el.css('position') == 'fixed');
            if ($(this).scrollTop() > 400 && !isPositionFixed) {
                $('.vis-panel.vis-top').css({ 'position': 'fixed', 'top': '0px', 'left': '962px'});
            }
            if ($(this).scrollTop() < 450 && isPositionFixed) {
                $('.vis-panel.vis-top').css({ 'position': '', 'top': '0px', 'left': '413px'});
            }
        });
    });
</script>
yotamberk commented 7 years ago

Why use a sticky header instead of simply defining the timeline height with the height option? If you want a scrollbar, you can use the verticalScroll:true.

deniz946 commented 7 years ago

Can you give me more information please?

2017-09-16 18:56 GMT+02:00 Yotam Berkowitz notifications@github.com:

Why use a sticky header instead of simply defining the timeline height with the height option? If you want a scrollbar, you can use the verticalScroll:true.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/almende/vis/issues/3435#issuecomment-329980813, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ_h6jPvoVm0dRPTwRcM6SFCdmmq0DzMks5si_3VgaJpZM4PTAui .

VivienGiraud commented 6 years ago

He meant adding this to options: height: 200, verticalScroll:true But the problem is that header is still at bottom, you can only scroll the left group tab and it's laggy AFAIK (3 hours experience on this...)