I am using this code to scroll to an element on a a new page (script is located bottom of page)
jQuery(document).ready( function(){
setTimeout(function() {
if (location.hash) {
window.scrollTo(0, 0);
}
}, 1000);
});
jQuery(window).on('load', function(){
var divScrollToAnchor = window.location.hash;
if( typeof divScrollToAnchor !== 'undefined' ) {
var t = setTimeout( function(){
jQuery('html,body').stop(true).animate({
'scrollTop': jQuery(divScrollToAnchor).offset().top - 80
}, 700, 'easeOutQuad');
}, 1000);
}
});
it workz but the console throws the following error:
TypeError: undefined is not an object (evaluating 'jQuery(divScrollToAnchor).offset().top')
searched the web and fiddeled around but am no success to fix it.
can you please help, thx a bunch
