My nav looks like this:
<a href="index.html" class="nav">Home</a>
<a href="about.html" class="nav">About</a>
<a href="#" class="nav">Services</a>
<a href="contact.html" class="nav">Contact</a>
On index.html I briefly mention the two services offered and include a "read more" link for each one. It looks like this:
<div style="width:468px; height:180px; float:left; font-family:Lucida Grande,Lucida Sans Unicode,Calibri,Arial,sans-serif;font-size:13px;line-height:17px;color:#666666;">
<span class="article"><b style="font-size:14px; color:#000000">Service #1</span>
<div style="padding-right:24px; padding-top:6px;font-size:12px; line-height:18px; color:#333333">Description</div> <!-- end "div" -->
<a href="vpn.html" class="readmore">Read More</a>
<div style="clear:both; font-size:1px; line-height:1px;"></div> <!-- end "div" -->
</div> <!-- end "div" -->
<div style=" width:228px; height:180px; margin-left:12px; float:left; font-family:Lucida Grande,Lucida Sans Unicode,Calibri,Arial,sans-serif;font-size:13px;line-height:17px;color:#666666;">
<span class="article"><b style="font-size:14px; color:#000000">Service #2</b></span>
<div style="padding-top:6px;font-size:12px; line-height:18px; color:#333333">Description. <a href="#" class="readmore">Read More</a>
</div> <!-- end "div" -->
</div> <!-- end "div" -->
Instead of being redundant and creating a services.html page, only to say the same thing I do on index.html and include more "read more" links, I'd like to do something with jQuery (since I'm already using it + Cycle for testimonials.)
When the services link is clicked, on whatever page, I would like it to go to index.html, scroll to the two div
s describing the services, change the background color (to yellow) for emphasis, and then fade back to normal (white.)
Is there a plugin for jQuery that will do this? Or how can I? I was looking at bgFader but since there's no demo I'm not sure this is what I'm looking for (and I don't know JS.)
EDIT
@Yi Jiang - It didn't work. I added this to my <head>
:
<!-- include jQuery library -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<!-- include Color plugin -->
<script type="text/javascript" src="js/jquery.color.js"></script>
<script type="text/javascript">
if(window.location.hash === '#services') {
var service = $('#services');
var originalColor = $('#services').css('background-color');
$('#services').css('background-color', '#FFEE9F').animate({
'background-color': originalColor
}, 1000);
}
</script>
And added id="services"
to one div
(for testing) and changed my anchor to index.html#services
. It scrolls to the right place (thanks!) but it doesn't change the background or do anything besides scroll. Did I screw something up?