I have a simple notification system. I want to use jquery to highlight the div onload by changing the background color and go back to normal after 500ms just a flash. Similar to when we answer questions on Stackoverflow. Simple enough to grab attention.
<div id="flash">Notification</div>
$(function() {
$( "#flash" ).animate({
backgroundColor: "#aa0000",
}, 1000 );
});
It does not work as expected. It does not switch back to #ffffff.
I appreciate any help.
jQuery UI has a specific effect for this called highlight. The issues of using
animateon properties likebackground-colorare described here:Edit if you really don’t want to go with the jQuery UI option, you could simulate a similar effect by wrapping the
background-colorinto its own element and hiding that out.example: http://jsfiddle.net/niklasvh/x2jrU/