What about this instead? I

What about this instead? I think your version will suffer from performance penalties.

$('.navbarItem').hover(
function () {
  // Mouse over, first hide previous gradients for all other navigation elements.
  $('.navbarItem').children(".gradient").hide();
  if ($(this).hasClass('hasGradient')) {
    // Show the gradient for this item.
    $(this).children('.gradient').show();
  }
  else {
    // Create a new gradient for this element
    $(this).addClass('hasGradient').gradient({ from: 'dddddd', to: 'aaaaaa' });
  }
},
function () {
   // Mouse out (this doesn't always get called - must be a bug), hide the gradient.
    $('.navbarItem').children(".gradient").hide();
}
);

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
3 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.