By Anonymous (not verified) on
Hi,
I'm trying to add an animated color transition on a div in my theme using jQuery UI. It's the version that ships with Drupal 7.12. I'm adding it in a custom js file which I'm loading through the themename.info file. The file is loading properly, and I can trigger an alert box when I hover over the div, but I can't get the animated color transition to work. Here's the code:
(function($) {
Drupal.behaviors.myBehavior = {
attach: function (context, settings) {
$('#region-postscript-first').hover(
function() {
$(this).stop().animate({backgroundColor:'#4E1402'}, 300);
}, function () {
$(this).stop().animate({backgroundColor:'#943D20'}, 100);
});
}
};
})(jQuery);I can see that several jquery.ui.whatever files are being loaded in the head of the page. Is there another jquery.ui plugin that I have to manually load to get this to work?
Any help is appreciated.
Comments
I'm having the same problem.
I'm having the same problem. Have you found a solution?
http://api.jquery.com/animate
http://api.jquery.com/animate/#animation-properties
Same here
Same here, any idea?
The solution
Download this in your theme folder
https://github.com/jquery/jquery-color
or
http://stackoverflow.com/a/3155141
add this into .info file
scripts[] = jquery.color.js
and this into your js file