JSFiddle - React, Tailwind, and code Playground

HTML

<a name="test">тут якорь, а ссылка на него внизу</a>
<div></div>
<a href="jhbj/hbj.html#test">к якорю</a>

CSS

div {height: 700px;}

JavaScript

$('a[href*="#"]').each(function(){
	var el = $(this);
  var result = /([^#]*)#(.+)$/i.exec(el.attr('href'));
	if(result){
  	el.attr('href',result[1])
      .on('click', function(e){
        var toel = $('[name="'+result[2]+'"');
      	if(toel.length != 0){
        	$('html, body').animate({ scrollTop: toel.offset().top }, 500);
        }
        return false;
      });
  }
});