我正在使用jQuery Tools的Scrollable作爲瀏覽整個單頁網站的手段。如何使用jQuery工具的可滾動深度鏈接
導航看起來是這樣的:
<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'});
所以導航水平移動到正確的頁面,但散不走的網址,也不能鏈接到幻燈片。
基本上,我怎麼既可以深入鏈接,也可以使用nav作爲插件的導航器目標?
響應於下面的答覆,
我嘗試這樣進行測試:
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的當前哈希標籤?
你應該讓'如果(哈希==「#聯繫「)'現在你問'如果哈希不是#聯繫.' – 2011-12-22 17:08:12
呃!謝謝。 – Keefer 2011-12-22 17:17:20