Typeahead.js: Option to open the dropdown menu above the input element

Created on 7 Oct 2014  路  7Comments  路  Source: twitter/typeahead.js

Most of the autocomplete libraries seem to lack this feature.

I can't be the only one who needs it... any forks done? :)

needs documentation

Most helpful comment

Just Set CSS as below:

.tt-menu.tt-open{
bottom:100% !important;
top:auto!important;
}

it will open suggestion up

All 7 comments

+1

Hi, if you open up typeahead.bundle.js and scroll down to line 760 you will see the styles for dropdown: { ... }. There you will see the style
top: "100%"
so change it to
bottom: "100%"
and it will open above instead.
hehe

@nadeemelahi, that suggestion doesn't work for me. Has anyone got a workaround for this?

edit: I played around with this a bit, discovered that I'm using https://github.com/bassjobsen/typeahead.js-bootstrap-css, which defines some !important styles which made it difficult to customize the position of the dropdown (actually, dropup now =))

@jfly What exactly did you do to get it working with typeahead.css? I would also be interested in this.

@danielbalog see my workaround here https://github.com/jfly/ccm/blob/0c0606ccee00cd391b6f8f168968c2c4b553c101/css/ccm.css#L66. Let me know if it works for you!

The styles are set in the js file, you have to edit the styles in the js file -namely line 760.
Or just use the search algorithm and design your own styles like I did here:
http://www.webscripts.biz:8082/js/myjscript.js --see the findMatches function, that is doing the search, I just tweaked the one in the typeahead example so that it search for multiple words instead of just one.

Just Set CSS as below:

.tt-menu.tt-open{
bottom:100% !important;
top:auto!important;
}

it will open suggestion up

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GunnarLieb picture GunnarLieb  路  4Comments

a-lucas picture a-lucas  路  5Comments

jarrodparkes picture jarrodparkes  路  6Comments

Nerian picture Nerian  路  5Comments

adamasantares picture adamasantares  路  5Comments