I have create link on same page . the content of this page is in the bottom and the anchor tab is on the top.
I would like to highlight the content area for 5 seconds when someone clicks on the top link (ancho).
I have create link on same page . the content of this page is in the bottom and the anchor tab is on the top.
I would like to highlight the content area for 5 seconds when someone clicks on the top link (ancho).
You can do it in very many ways, for example binding onHashChange and then changing background color:
$(window).bind('hashchange', function(){
$(".highlight").css("background","#AFA");
setTimeout(function(){
$(".highlight").css("background","transparent");
},5000);
});
Give each piece of content a unique id as follows:
<div id="content_1"> ... </div>
Then use jQuery to set up events for each link:
$("div").delegate("#content_1", "click", function() {
$('div.content_1').effect("highlight", {}, 3000);
});
Or you could use .on() or .live() but you get the idea.
use delay()
$('#id-of-anchor').click(function(){
$("#your-div").css('background','red').delay(5000).css('background','transparent');
return false;
});