Posted by africanherbsman on December 28, 2012 at 8:16pm
I'm trying to use an uncontroversial piece of code to change the background color of a div when the mouse hovers over it.
Although the code is being reached fine, my install of drupal refuses to register the hover event, I have tried substituting my code with a console.log('hovering') and I still get nothing. What am I missing here?
here is the code. http://jsfiddle.net/tmXfW/2/
( function($) {
var msg = $().jquery;
console.log(msg);
$('div.quicklink-row').hover(function() {
$(this).addClass('blue-link');
}, function() {
$(this).removeClass('blue-link');
});
})(jQuery);
Comments
See Managing JavaScript in
See Managing JavaScript in Drupal 7, search down for "Behaviors". Without the behavior (Drupal's preferred approach) or at least an "on ready" the element 'div.quicklink-row' is not likely to exist when your javascript is processed.