The title does not reflect the essence of the question. I have put a lot of anchors <a name="c1...с50"></a>
on my page <a name="c1...с50"></a>
and the link is <a name="c1...с50"></a>
by a link with the # c1 hash. So, it is necessary that the visible area of the window scrolls not to the anchor itself, but to a position 50 pixels above the anchor.
UPD Decided so:
$(document).ready(function() { // Прокрутка к закладке if(window.location.hash) { setTimeout(function(){ var scrollTop = $(window).scrollTop()-50; $('html, body').animate({scrollTop: scrollTop}, 'fast'); }, 50); } })
That is, just wait 50 milliseconds after loading and unscrew the window 50 pixels up ...