On StackOverflow website, you will notice your 'Notifications' indicator at the top left. When somebody replies to your question/answer, you click the notification and it directs you to that particular reply, then displays with an orange background and slowly fades to white, to let you know which reply you're looking at. I would like to know how I can achieve this fade method.
The element I would like to flash is a div. Below is how my DIVS are arranged as they are dynamically produced by ASP:
...
<div id="1046" class="photoBlob">........</div>
<div id="1047" class="photoBlob">........</div>
<div id="1048" class="photoBlob">........</div>
...
As you can see, it already contains styles (class="photoBlob"), the background is transparent until mouse-over, when it changes to grey.
The particular DIV I need to flash comes from a query string (photos.asp?photoID=1047). What I mean by flash, is to change the background of the DIV to color (#19426E) and then fade that color back to transparent after 2 seconds.
I could probably work it out if there was one DIV to flash and that I knew the DIV ID to flash, but coming from a query string, I have no idea what I am doing. I would be grateful for any suggestions, examples or snippets to get me started with this. I think I found JQuery plugins for flashing elements but even then, how do I feed that plugin with my query string 'photoID', my JS is rubbish obviously!
Many thanks
MY ANSWER - Thanks to (150PoundsOfDonamite)
I actually made a mistake, my div's id was NOT coming from a query string, it was coming from the anchor/hash part of the URL. So thanks to the accepted answer (below), I managed to get this working - and looks the biz!
I added the JQuery plugin: http://www.bitstorm.org/jquery/color-animation/
I then added this JQuery/Javascript:
$(document).ready(function() {
var flashDiv = window.location.hash;
if(flashDiv!==false) {
setTimeout(function() {
$(flashDiv).animate({backgroundColor: '#19426E'}, 2000);
$(flashDiv).animate({backgroundColor: 'rgba(0,0,0,0)'}, 2000);
}, 1000);
}
});