How do I remove an active outline from jquery accordion?
Asked Answered
P

7

18

I am using Jquery Accordion. The active link has an outline. I have tried using css:

#accordion a:focus
 { outline: none; }
#accordion a:active 
{outline: none; font-weight:bold;}

and also

#accordion a:-moz-any-link:focus 
{ outline: none; }

None of these seem to work. Can anyone advise a setting or another option to remove the dotted outline around the active links?

Pula answered 18/1, 2010 at 14:30 Comment(2)
there are like 20 accordion plugins out there can you provide a link?Honeymoon
PS: outline:none is not a good idea in general for accessibility: outlinenone.comJeweller
K
23

You need to figure out the tab element's class being applied by the widget. For instance,

.ui-state-focus { outline: none; }

works on the most recent version of jQuery UI, but on an earlier version like the 1.6, you'd need to use this:

.ui-accordion-header {outline: none;}
Koestler answered 4/5, 2010 at 16:5 Comment(0)
R
9

Add this to your CSS stylesheet and it will take care of the blur/focus outline:

#accordion .ui-state-focus{
    outline: none;
}
Rebarebah answered 27/4, 2010 at 23:36 Comment(1)
I like how this solution is specific to the accordion and won't affect other jquery scripts. +1Dispensatory
S
3

I have only seen this happen with header tags so far. To remove it, add the code

h1, h2, h3, h4{outline:none;}
Summons answered 2/11, 2011 at 17:24 Comment(0)
D
1

If you're using jQueryUI's Accordion, http://jqueryui.com/demos/accordion/, you shouldn't have a problem with these types of outlines. If you are though, you could do the following:

$(".ui-accordion-header a").click(function(){
  $(this).blur();
});

In fact, this method will work with just about any accordion plugin - just be sure to modify the selector to target the links responsible for expanding/collapsing the data panels.

Diversification answered 18/1, 2010 at 14:38 Comment(0)
S
0

When I need to override the styles applied by jQuery UI elements, I usually add a stylesheet that I load after the jQuery UI stylesheet and put my overrides into it, using the same selectors so that I know that my styles will take precedence. In this case look for the styles associated with the accordion or the widget state and override them.

Sorrell answered 18/1, 2010 at 14:34 Comment(0)
P
0

SORTED:

amend the css to - ui-state-focus

Pula answered 18/1, 2010 at 16:10 Comment(0)
L
-1

Be sure to press F5 once in a while... and make sure you are not editing other files than you think you are.

Liszt answered 18/1, 2010 at 15:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.