web: in registerCharClick set the window.location.hash and listen to that event to highlight the new row

This commit is contained in:
Thomas R. Koll 2015-12-18 10:14:09 +01:00
parent b6c3ba1caf
commit 71f4dc53b1

View File

@ -31,6 +31,10 @@ $(document).ready(function() {
if (window.location.hash && $(window.location.hash)[0]) {
$(window.location.hash).addClass('highlighted');
}
$(window).on('hashchange', function(event) {
$('.highlighted').removeClass('highlighted');
$(window.location.hash).addClass('highlighted');
});
});
//----------------------------------------------------------------------
@ -99,8 +103,10 @@ function registerChart($container, series) {
function registerChartClick(ev, pos, item) {
if (item) {
$target = $('#'+item.series.data[item.dataIndex][5]);
targetselector = '#'+item.series.data[item.dataIndex][5];
$target = $(targetselector);
if ($target.length) {
window.location.hash = targetselector;
$('html, body').animate({
scrollTop: $target.offset().top
}, 1000);