1

I want to highlight a <span> using jQuery.effect('highlight'), but it fades out after a period of time.

How can I get the highlight to be persistent?

My code is:

 $('span').live('click', function () {
        $(this).effect("highlight", { color: "#ff3fff"});
    });
Alan
  • 45,915
  • 17
  • 113
  • 134

2 Answers2

4

I don't think the highlight effect has a persistant state, you could just set the background colour:

$('span').live('click', function () {
    $(this).css("backgroundColor", "#ff3fff");
});
Ben Everard
  • 13,652
  • 14
  • 67
  • 96
2

If you're using UI, try this:

$('span').live('click', function () {
   $(this).animate({backgroundColor: '#aa0000', color: '#fff'}, 1000);
});

Since jQuery UI has the color plugin integrated, you can animate color fading aswell.

jAndy
  • 231,737
  • 57
  • 305
  • 359