From d1bc8790a2484026219bf493b35af509a7794732 Mon Sep 17 00:00:00 2001 From: alexeykuz Date: Sat, 19 Nov 2016 20:40:03 +0200 Subject: [PATCH] Fix left for fixed position with horizontal scroll (#30) --- js/theia-sticky-sidebar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/theia-sticky-sidebar.js b/js/theia-sticky-sidebar.js index 2156634..9897f37 100755 --- a/js/theia-sticky-sidebar.js +++ b/js/theia-sticky-sidebar.js @@ -255,11 +255,12 @@ * It's way slower to first check if the values have changed. */ if (position == 'fixed') { + var scrollLeft = $(document).scrollLeft(); o.stickySidebar.css({ 'position': 'fixed', 'width': getWidthForObject(o.stickySidebar) + 'px', 'transform': 'translateY(' + top + 'px)', - 'left': (o.sidebar.offset().left + parseInt(o.sidebar.css('padding-left'))) + 'px', + 'left': (o.sidebar.offset().left + parseInt(o.sidebar.css('padding-left')) - scrollLeft) + 'px', 'top': '0px' }); }