FadeIn/FadeOut or other effect on Toggle or ToggleClass
The following works very well to highlight a table cell with a background color when the cell is clicked:
-
jQuery("td").toggle(
function () {
jQuery(this).addClass("highlight");
},
function () {
jQuery(this).removeClass("highlight");});
This also works with toggleClass:
-
jQuery("td").click(function() { jQuery(this).toggleClass('highlight');});
css is simple: highlight {background:yellow;}
I just can't figure out how to incorporate a fadeIn and fadeOut effect with toggle or toggleClass. I'd like to be able to control the speed of the hightlight when a user clicks a cell on the table. Thanks in advance for any ideas!