Theme: JS - Fix a bug preventing edit margin suppression to work

Explanation: an ID with a leading digit isn't a valid CSS selector
This commit is contained in:
ArthurHoaro 2017-03-27 19:15:48 +02:00
parent b320c860f5
commit 0040058da6

View file

@ -255,10 +255,9 @@ window.onload = function () {
* Remove CSS target padding (for fixed bar) * Remove CSS target padding (for fixed bar)
*/ */
if (location.hash != '') { if (location.hash != '') {
var anchor = document.querySelector(location.hash); var anchor = document.getElementById(location.hash.substr(1));
if (anchor != null) { if (anchor != null) {
var padsize = anchor.clientHeight; var padsize = anchor.clientHeight;
console.log(document.querySelector(location.hash).clientHeight);
this.window.scroll(0, this.window.scrollY - padsize); this.window.scroll(0, this.window.scrollY - padsize);
anchor.style.paddingTop = 0; anchor.style.paddingTop = 0;
} }