Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using Accordion from jQuery UI, I'm getting an unwanted blue highlight around the last clicked link

Tags:

jquery-ui

I'm using the Accordion widget from jQuery UI.

Whenever I click a header to expand a section, that header (actually, the link inside the h3 element) is highlighted. In Chrome it has a blue highlight as if it were the currently selected field in a form.

I need to get rid of the blue highlight, so I hacked together the code below, and it seems to work so far.

However, I'm wondering if there's a better/cleaner way to do this in jQuery. Is this right??

$(function() {
  $( "#mainnav" ).accordion().blur($('#mainnav'));
});
like image 896
Ben Coppock Avatar asked Nov 24 '10 10:11

Ben Coppock


1 Answers

I didn't need jQuery to fix the problem after all (.blur() didn't seem to work).

jQuery was adding a class = "ui-state-focus" to the html, so I used CSS to indicate that this class shouldn't be outlined/highlighted, like so...

#mainnav .ui-state-focus {
  outline: none;
}
like image 141
Ben Coppock Avatar answered Nov 25 '22 12:11

Ben Coppock