Bug Tracker

Modify

Ticket #294 (closed feature: worksforme)

Opened 7 years ago

Last modified 7 years ago

hoverClass

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

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.

Change History

comment:1 Changed 7 years ago by joern

  • Status changed from new to closed
  • Resolution set to worksforme

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)
  });
};

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.