HTML: Scroll page to the top before showing the detailed view.

When looking at the dive list view, clicking on the 'show more details'
retains the view at the current vertical position, meaning that the
graph is somewhere above, outside the page view.

Page must be scrolled to the top before viewing the detailed dive view.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad elrobey 2014-08-12 13:30:18 +03:00 committed by Dirk Hohndel
parent fda5ff2af2
commit 8bc232b0bd

View file

@ -1166,6 +1166,7 @@ function showDiveDetails(dive)
document.getElementById("diveListPanel").style.display = 'none'; document.getElementById("diveListPanel").style.display = 'none';
document.getElementById("divePanel").style.display = 'block'; document.getElementById("divePanel").style.display = 'block';
canvas_draw(); canvas_draw();
scrollToTheTop();
} }
function setDiveTitle(dive) function setDiveTitle(dive)
@ -1218,6 +1219,11 @@ function switchDives(e)
} }
} }
function scrollToTheTop()
{
window.scrollTo(0, 0);
}
window.onresize = function(event) window.onresize = function(event)
{ {
if (plot1) if (plot1)