Commit 70868954 authored by Leo Iannacone's avatar Leo Iannacone

workaround for sticky.start on page load and sidebar has offset().top = 0

parent b33dd391
...@@ -192,22 +192,17 @@ function Page_Distrubion(socket) ...@@ -192,22 +192,17 @@ function Page_Distrubion(socket)
// sticky sidebar // sticky sidebar
var sticky = { var sticky = {
start: function() { start: function() {
$(window).scroll(function() { $(window).scroll(function() {
// FIXME: on load sidebarOffset is always 0 !!!
if (sidebarOffset == 0) if (sidebarOffset == 0)
return return
if ($(window).scrollTop() > sidebarOffset) { if ($(window).scrollTop() > sidebarOffset) {
//console.log("sidebar.start -> adding: ", $(window).scrollTop(), sidebarOffset, $("#files").offset().top)
$("#files").addClass('fixed') $("#files").addClass('fixed')
} else { } else {
//console.log("sidebar.start -> remove: ", $(window).scrollTop(), sidebarOffset, $("#files").offset().top)
$("#files").removeClass('fixed') $("#files").removeClass('fixed')
} }
}) })
}, },
reset: function() { reset: function() {
var sidebar = $("#files") var sidebar = $("#files")
sidebarOffset = sidebar.offset().top sidebarOffset = sidebar.offset().top
...@@ -326,6 +321,8 @@ function Page_Distrubion(socket) ...@@ -326,6 +321,8 @@ function Page_Distrubion(socket)
$(window).on('load', function () { $(window).on('load', function () {
__check_hash_makes_sense() __check_hash_makes_sense()
populate() populate()
// FIXME: workaround for sticky.start() on page load and offset is 0
this.setTimeout(sticky.reset, 500);
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment