関連ページの例 - http://brettcolephotography.com/search.html
このページ「検索」は、トップレベル メニューの「ライブラリ」の下にあるドロップダウン アイテムです。
このスニペットを使用して現在のナビゲーション項目を強調表示していますが、うまく機能します (Joe さんに感謝します!)
$(document).ready(function(){
var loc = window.location.href.replace(window.location.hash, '');
$('#bcp-nav a').each(function(index) {
if(this.href.trim() == loc)
$(this).addClass("selected");
});
});
また、Dynamic Driveの人気のあるanylink jsメニュー スクリプトを使用して、ナビゲーション ドロップダウンを強化しています。
現在強調表示されている状態をサブメニューの項目に渡したいと思います。この場合、この検索ページにいるときに「ライブラリ」のトップナビ項目が強調表示されます。同様のケースすべてに適用できるような構造を実装したいと考えています。
この例のメニュー コンテンツ ファイルのコード
var anylinkmenuLIBRARY={divclass:'anylinkmenu', inlinestyle:'', linktarget:''} //Second menu variable. Same precaution.
anylinkmenuLIBRARY.items=[
["galleries", "http://brettcole.photoshelter.com/gallery-list"],
["search", "http://brettcolephotography.com/search.html"],
["advanced search", "http://brettcole.photoshelter.com/search-page"],
["lightbox", "http://brettcolephotography.com/lightbox.html"]
//no comma following last entry!
]
この場合、対応するliにフックします
<li><a href="http://brettcole.photoshelter.com/gallery-list" class="menuanchorclass" rel="anylinkmenuLIBRARY">library</a></li>
どうもありがとう!