Skip to main content

Bug Tracker

Side navigation

#294 closed feature (worksforme)

Opened October 20, 2006 08:48AM UTC

Closed October 27, 2006 09:34AM UTC

hoverClass

Reported by: giel.berkers@gmai.co Owned by:
Priority: minor Milestone:
Component: event Version:
Keywords: hover hoverclass mouseover mouseout Cc:
Blocked by: Blocking:
Description

It would be nice if there was a feature called hoverClass. Which would simply add a class on a mouseover event and remove it on mouseout. The source would then look like something like:

$("h3").hoverClass("over");

This offcourse would add the class "over" to the h3-element on mouseover and remove it on mouseout.

Attachments (0)
Change History (1)

Changed October 27, 2006 09:34AM UTC by joern comment:1

resolution: → worksforme
status: newclosed

This can be easily added if needed, try this (tested):

jQuery.fn.hoverClass = function(value) {
  return this.hover(function() {
    jQuery(this).addClass(value);
  }, function() {
    jQuery(this).removeClass(value)
  });
};