noon wrote:
First of all, you should be assigning your content links (the ones on
the left) classes and not IDs. Not only is it bad practice, but
jQuery will stop after it hits the first one.
Another approach is to use individual ids using the feed id as the
prefix, e.g. feedID5-1, feedID5-2, etc, then use some JS like this:
$("a.sourceLink").click(function() {
$("#News li:not([id^=" + this.id + "])").slideUp();
$("#News li[id^=" + this.id + "]").slideDown();
return false;
});
noon is right that you should never duplicate ids. But sometimes having
these parially-matching id's can help. I actually used this approach on
a demo version of your code I put here:
http://scott.sauyet.com/Javascript/Demo/2008-07-11a/
Note that I made several other changes in this version: I put the
sourceLinks inside <LI> elements and added an "All" filter which
re-displays the entire list. I also started to do some code cleanup to
get it to validate until I realized that many of the errors were in the
actual feeds. None of these changes are necessary, though. Just
changing the ids and using the JS above should help.
Good luck,
-- Scott