我有一些这样的链接:
<ul class="vertlist">
<li><a href="#personal" title="Go to Personal section." class="crumblink">Personal</a></li>
<li><a href="#business" title="Go to Business section." class="crumblink">Business</a></li>
<li><a href="#company" title="Go to Company section." class="crumblink">Company</a></li>
<li><a href="#engineering" title="Go to Engineering section." class="crumblink">Engineering</a></li>
<li><a href="#it" title="Go to IT section." class="crumblink">IT</a></li>
<li><a href="#hr" title="Go to HR section." class="crumblink">HR</a></li>
</ul>
还有一些应该允许一些平滑导航的jquery:
$(document).ready(function () {
$('.crumblink').click(function () {
$('html, body').animate({
scrollTop: $($.attr(this, 'href')).offset().top
}, 500);
return false;
});
})
在我单击任何链接的那一刻,我得到一个未捕获的异常:
“无法读取 null 的属性顶部”
例如个人的锚标签是这样的:
<h2><a name="personal" id="myPersonal">Personal</a></h2>