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
  • 44,339
  • 17
  • 112
  • 132

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,556
  • 12
  • 65
  • 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
  • 223,102
  • 54
  • 301
  • 354