我使用 jQuery Tools 的 Scrollable 作为浏览整个单页站点的方法。
导航如下所示:
<div id="mainNavContainer">
<nav>
<a id="logo" href="#home" title="Hughes Opticians, Delmar, NY"></a>
<a href="#who-we-are" title="Who We Are">Who We Are</a>
<a href="#eye-exams" title="Eye Exams">Eye Exams</a>
<a href="#gallery" title="Gallery">Gallery</a>
<a href="#eyewear" title="Eyewear">Eyewear</a>
<a href="#contact-lenses" title="Contact Lenses">Contact Lenses</a>
<a href="#contact" title="Contact">Contact</a>
</nav>
</div>
jQuery 触发它看起来像这样:
$("#homeScrollable").scrollable({circular:true, next:'.mainNext', prev:'.mainPrev'}).navigator({navi:'#mainNavContainer nav'});
所以导航水平移动到正确的页面,但哈希没有转到 URL,我也不能链接到幻灯片。
基本上,我如何既可以进行深度链接,又可以使用导航作为插件的导航器目标?
针对下面的回复,
我试过这个来测试:
var hash = self.document.location.hash.substring(1) ;
if(hash == "home"){
console.log('Home page')
}
if(hash == "who-we-are"){
console.log('Who we are page')
}
if(hash == "eye-exams"){
console.log('Eye Exams page')
}
if(hash == "gallery"){
console.log('Gallery page')
}
if(hash == "eyewear"){
console.log('Eyewear page')
}
if(hash == "contact-lenses"){
console.log('Contact Lenses page')
}
if(hash == "contact"){
console.log('Contact page')
}
控制台将每个 console.log 消息回显两次。它不应该只是回显我的 URL 当前的哈希标签吗?