Commit 8d895a33 authored by Kjetil Thuen's avatar Kjetil Thuen

Improved target accuracy

parent 78bbb9e2
......@@ -83,7 +83,7 @@ inScroll = false;
var horizontalCenter = Math.floor(window.innerWidth/2),
centerOfHeadline = 0,
focusedListElement = null,
target_bottom = 0,
target_top = 0,
scrollVal,
scrollListenersEnabled = false,
scrollInProgress = false,
......@@ -126,8 +126,7 @@ inScroll = false;
$('#target').animate({height: listElem.height(),'margin-top': marginDiff + 'px'}, 'fast');
}
//FIXME: Figure out where the 60pixels come from and make them dynamic
$('body').animate({scrollTop: scrollVal + 60}, 'fast');
$('html,body').animate({scrollTop: scrollVal}, 'fast');
details = listElem.find("div.abstract").html();
scrollInProgress = false;
......@@ -151,8 +150,8 @@ inScroll = false;
listElem.addClass('selected');
focusedListElement = listElem;
scrollVal = listElem.offset().top + listElem.height() - $('#studies_list').position().top;
console.log("Debouncing expand function");
scrollVal = listElem.offset().top - $('#target').position().top;
console.log("Debouncing expand function at " + scrollVal);
debounce(show_expanded_info, 500, false)();
} else {
$('#expander').hide();
......@@ -168,16 +167,15 @@ inScroll = false;
};
var initialize_list_peek = function() {
target_bottom = $('#content').position().top;
// $('#target').css({bottom: target_bottom});
target_top = $('#content').position().top;
$('#target').css({top: target_top});
horizontalCenter = Math.floor(window.innerWidth/2);
//FIXME: Figure out where the 60pixels come from and make them dynamic
$('#expander').css({top: target_bottom - 60});
$('#expander').css({top: target_top + $('#target').height()});
centerOfHeadline = $('#target').offset().top - $(window).scrollTop() + ($('#target').height() / 2);
if (!handlersRegistered) {
register_event_handlers();
}
//set_selected_element(focusedListElement);
set_selected_element(focusedListElement);
};
var register_event_handlers = function() {
......
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