There is a sorting unit, the sorting is performed on the server. After reloading the page, it is necessary to smoothly scroll to the sorted content.
I hook the anchors #sort_anchor to the url of the buttons, in the header before loading the html hard disk:
window.hashName = window.location.hash; window.location.hash = ''; In the template I call
$(window).load(function () { $('html, body').animate({scrollTop: $(window.hashName).offset().top-50}, 500); return false;}); Everything works, smooth scrolling is. But there was an error:
Uncaught TypeError: Cannot read property 'top' of undefined I understand the reason, how to solve I do not know. Prompt pl!