Skip to content

Commit f33eb0c

Browse files
committed
Merge pull request scala#239 from jimschubert/master
Fix for sidebar scroller
2 parents 5187ffc + 588dcc3 commit f33eb0c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
11
function moveScroller() {
2+
var c = $("#scroller");
3+
var uh = $(c).height();
24
var a = function() {
35
var b = $(window).scrollTop();
46
var d = $("#scroller-anchor").offset().top;
5-
var c=$("#scroller");
6-
if (b>d) {
7+
var e = $(".footer").offset().top;
8+
if (b>d && ((b+$(window).height()))<e) {
79
c.css({position:"fixed",top:"60px"})
810
} else {
911
if (b<=d) {
10-
c.css({position:"relative",top:""})
12+
c.css({position:"relative",top:""});
13+
} else {
14+
// wrapper height must be calculated here because of disqus
15+
var wh = $('.wrapper').height();
16+
var calc = (-1*Math.abs(wh-b-d-uh-60));
17+
c.css({position:"fixed",top:calc+"px"});
1118
}
1219
}
1320
};
1421
$(window).scroll(a);a()
15-
}
22+
}
23+
24+
$(function() { moveScroller(); });

0 commit comments

Comments
 (0)