1. 项目演示
$('ul#manualtest').lavaLamp({startItem: 3});
2. selectedLava (& noLava) class tests
<li class="selectedLava"><a href="/projects/lavalamp/urltest/">trailing slash</a></li>
3. home element test
$('ul#hometest').lavaLamp({homeTop:100, homeLeft:100, returnHome:true});
4. URI Matching::
- absolute path tests:
LavaLamp defaults to the longest href found that matches the full window.location path+query+hash reference. In the test above, the first absolute with trailing slash link always highlights even when clicking the no trailing slash link because the browser always delivers a trailing slash on path only links, making the longer a href
match the winner in any case.
- relative path tests:
Notice when you click the 3rd or 4th link above, the similar absolute links are also highlighted in the previous absolute tests menu. A menu with similar mixed absolute and relative a href links will always default to the longest a href
match.
- mixed absolute and relative path tests:
While obviously the last two links offer more detail than the first, because the first link is the longest a href
and matches within the full path delivered by window.location it wins for default. Yes, code could be added to attempt a full mixed match, but to keep LavaLamp as lean as possible I am leaving it this way for now.
Some tips for using automatic start location:
- be consistent: do not mix and match relative with absolute paths in your menu links
- be absolute: always use absolute pathed links for most accurate matching
- check your source: don't be fooled by the location you see in the status bar when you hover over a link, the browser compensates for relative links just like window.location.