I added this code to MediaWiki:Metrolook.js and it worked.
$(function(){
function hasDoubleByte(str) {
for (var i = 0, n = str.length; i < n; i++) {
if (str.charCodeAt( i ) > 255) { return true; }
}
return false;
}
/**********************************************************************************************
* Fix a bug where clicking on an title in the content did not scroll the screen to that section
*/
$(".tocnumber,.toctext").off("click").on("click",function(){
if (hasDoubleByte(this.textContent)){
var href = $(this).parent().attr("href");
window.location.replace(href);
setTimeout(function() {
$('html, body').animate({
scrollTop: '-=50'
}, 200);
},100);
}
});
/**********************************************************************
* Fix the title being hidden in the menu when jumping to the anchor
*/
if(location.hash && window.scrollY < document.documentElement.scrollHeight - document.body.clientHeight){
$('html, body').animate({
scrollTop: '-=50'
}, 200);
}
});