JQuery autocomplete appears behind JQuery menu

Soldato
Joined
31 May 2006
Posts
4,239
Location
127.0.0.1
Hi guys

Can anyone help with this problem? I have a JQuery autocomplete search box which when displaying the search results in the dropdown window appears behind a JQuery dropdown menu directly below it (see image). I have tried increasing the z-index value of everything I can find in the CSS for the autocomplete search but it still doesn't fix the problem. What else should I be trying?

Fiddle link: http://jsfiddle.net/tonyyeb/LKDBh/18/

error_zps96aa5ad5.png


Thanks in advance :)
 
Last edited:
Associate
Joined
25 Feb 2007
Posts
905
Location
Midlands
It's because the top level list items have a z-index of 100 I think.

Code:
/*Top level list items*/
.ddsmoothmenu ul li{
position: relative;
z-index: 100;
display: inline;
float: left;
}

You'd need to find out the html that is displayed for the autocomplete drop down, and give it a higher z-index...
 
Soldato
Joined
3 Jun 2005
Posts
3,119
Location
The South
The autocomplete wrapper is being given a z-index of 1 by the jQuery library (hard-coded), whereas the menu (via CSS) has a z-index of 100; easiest solution is to use -
Code:
.ui-autocomplete {
    z-index: 100 !important;
}
 
Soldato
OP
Joined
31 May 2006
Posts
4,239
Location
127.0.0.1
The autocomplete wrapper is being given a z-index of 1 by the jQuery library (hard-coded), whereas the menu (via CSS) has a z-index of 100; easiest solution is to use -
Code:
.ui-autocomplete {
    z-index: 100 !important;
}

Give that man a million pounds!! Thank you so much!! I've been banging my head on a brick wall for the past two days over this ha!!
 
Associate
Joined
19 May 2003
Posts
1,390
Location
Saltaire, West Yorkshire
Just remember that !important declarations should be avoided where possible, in this scenario it will be fairly safe but you should really change the fixed value to 100 or even better make it configurable.
 
Soldato
Joined
3 Jun 2005
Posts
3,119
Location
The South
Funny you should say that cause I've just removed the !Important and changed the value to 999 and it worked. But I was sure I'd tried that?!! :confused:

Surprised, it didn't want to know when testing it in jsFiddle with 1.8.18 of the jQuery UI library (this 'bug' has been eliminated in the latest version) :confused:


Phunky - True but i wouldn't have thought it's an issue if used to override fixed styling within libraries/frameworks.
 
Back
Top Bottom