/    Sign up×
Community /Pin to ProfileBookmark

jquery or javascript – link color only changes on focus link?

i want the link only to change color when clicked and content changes in window “#gallery”. Then when click on another link, it goes back to original color and new link is now changed. Basically, only when link is acitve or focused on then it’s new color so user knows link and content that’s being viewed. Here is code for head:
<script type=”text/javascript”>
$(document).ready(function() {
$(‘#links a’).click(function() {
var url=$(this).attr(‘href’);
$(‘#gallery’).load(url + ‘ #newsItems’);
return false;
});
});
</script>

here is code body:

<!– BEGIN MAIN CONTENT –>
<ul id=”links”>
<li class=”active”><a href=”faqsAnswer_01.html”>Which are the safari countries?</a></li>
<li><a href=”faqsAnswer_02.html”>Best country for safari?</a></li>
<li><a href=”faqsAnswer_03.html”>Best season for safari?</a></li>
<li><a href=”faqsAnswer_04.html”>Is safari &ldquo;roughing it?&rdquo;</a></li>

<li><a href=”faqsAnswer_05.html”>Cost of a typical safari?</a></li>
<li><a href=”faqsAnswer_06.html”>Do I have enough vacation time?</a></li>
<li><a href=”faqsAnswer_07.html”>Do I have to get shots?</a></li>
<li><a href=”faqsAnswer_08.html”>Is Africa always hot?</a></li>
<li><a href=”faqsAnswer_09.html”>Will I be eating bugs?</a></li>
<li><a href=”faqsAnswer_10.html”>Will bugs be eating me?</a></li>

<li><a href=”faqsAnswer_11.html”>Am I safe in Africa?</a></li>
<li><a href=”faqsAnswer_12.html”>Who should go on safari?</a></li>
</ul>
<!– END MAIN CONTENT –>
</div>

<!– BEGIN WINDOW CONTENT –>
<div id=”gallery”>
<img src=”images/elephant.jpg” alt=”elephant” width=”270″ height=”340″ />
</div>

<!– END WINDOW CONTENT –>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@earth2macauthorJan 22.2010 — that works by itself but not with the other script. How can i use it within the existing js/jquery script on page, since i need to use this as well.
×

Success!

Help @earth2mac spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...