I am trying to create a simple pulsed effect by changing the background color using jQuery. However, I cannot get backgroundColor for the animation.
function show_user(dnid) { if (! $(dnid).is(':visible')) { $(dnid).show() } $('html, body').animate({scrollTop: $(dnid).offset().top}); $(dnid).animate({backgroundColor: "#db1a35"}, 1200); }
What is strange is that this alternative animation works:
$(dnid).animate({opacity: "toggle"}, 1200);
But that is not what I want at all.
In addition, the show () and scroll functions in the function work fine. This is just a color background animation that does not.
The above function is called from this link <a href="#" onclick="javascript:show_user('#9e4cde88b90004ea722e9e129ed83747')">Locate Me</a>
Can someone help me change the background color?
==========
Thank you all for your help. Many similar answers. Here is what I ended up with
In my title
<script src="http://code.jquery.com/color/jquery.color-2.1.2.min.js"></script>
Then in my show_user function right after the scroll animation.
var bgcol = $(dnid).css('backgroundColor'); $(dnid).animate({backgroundColor: "#db1a35"}, 2000); $(dnid).animate({backgroundColor: bgcol}, 2000);
This gives a relatively quick red βboostβ that would draw the user's eyes.
Thanks again for the help.
fandingo
source share