Fixed glitches with headings by replacing a CSS hack by a JS solution.

This commit is contained in:
Šesták Vít
2016-02-10 10:57:23 +01:00
parent 5102855990
commit 2d3e3b5164
4 changed files with 11 additions and 8 deletions

View File

@@ -56,4 +56,11 @@ function toggleClassified(el){
btn.addClass("btn-danger");
}
});
}
}
function updatePosition(){
// document.getElementById(…) is used over $('#'+…) in order to reduce attack surface: It does not look like a good idea to pass untrusted input to “omnipotent” `$` function.
$.scrollTo(document.getElementById(location.hash.substr(1)), {offset: -$('#navbar').height()});
}
$(window).bind('hashchange', function(e) { updatePosition(); });
$(window).bind('load', function(e) { updatePosition(); });