Angelo Sozzi schrieb:
> Hi
> 
> I'm working on an A-Z list implementation and have several questions. Since
> the list is not VERY long (50kb) I moved away from breaking it up and
> calling letters using AJAX. Now I load the full tables in one go and just
> hide the ones not used (most people would hunt through the list anyway).
> Demo: http://www.sfu.ca/ehs/AtoZ/
> 
> 1) Stripping the tables (aesthetics):
>  I use $('.stripMe li:odd').addClass('alt'); to add alt to the tables where
> tables are like this:
> <ul class="azlist">
>       <li id="A"> A 
>               <ul class="stripMe">
>                       <li> "http:// ...........etc...</li 
>                           ...
>                  </ul>
>       </li>
>       <li id="B"> B 
>               <ul class="stripMe">
>                                       <li>  "http:// ...........etc...</li 
> 
> The li:odd seems to continue from table A to table B. If table A has and
> even number of <li> elements, table B will start with an "alt" row, how can
> I reset the counter between tables?
> 
> 2) Using the location.hash to show a table
> I use var hash = location.hash.replace('#', ''); 
> to show the appropriate table if the page was called using the drop-down
> links (the top bar "A-Z").
> But once on the page a click on the drop-down links will not show the right
> table, I assume this is because the page is not reloaded and the hash is not
> checked again. Is there a way to check the hash periodically?
> 
> Thanks! jQuery rocks! I wouldn't even be trying this if not for this
> fun/cool tool.

I think you could use my history plugin for that...:

Your letter links would have to look like this and let's assume for now 
that they have the class "letter":

<a class="letter" href="#b">B</a>

Then use the following (undocumented) plugin method:

$('a.letter').history();
$.ajaxHistory.initialize();

And attach the proper click event handler to show the tables according 
to the link...

You'd have bookmarking and back button support with that.

Well, you could also just use my Tabs plugin for that.


-- Klaus



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to