TypeError: $(…).offset(…) is undefined
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm getting this error TypeError: $(...).offset(...) is undefined with the arrow pointing to the $. I've looked at the questions that popped up when I typed this error into the title, but I didn't get a solution. Here is my jquery $(document).ready(function () { if(window.location.href.indexOf("#") > -1) { var pieces = window.location.href.split(/[\s_]+/); var section = pieces[pieces.length-1]; var element_to_scroll_to = $('#' + section); var navbar_height = parseInt($('.navbar').css('height').replace('px', '')); animate_scroll(element_to