typeahead.js icon indicating copy to clipboard operation
typeahead.js copied to clipboard

Bootstrap 3 broken style

Open Stajor opened this issue 13 years ago • 72 comments

Changed css in bootstrap 3 Before: http://d.pr/i/44ma After: http://d.pr/i/dv1W

Stajor avatar Jul 31 '13 21:07 Stajor

I haven't had a chance to take a look at Bootstrap 3 yet. It's on my TODO list.

jharding avatar Aug 01 '13 08:08 jharding

I came to post this as well. I'm glad to see it's been recognized. Here is a jsFiddle with the current typeahead.js and Bootstrap 3 that illustrates some of the basic CSS problems like the hint being offset and the input not spanning 100% once typeahead is applied.

Hope that helps when you get to it!

Edit: Fixed link.

ericsaupe avatar Aug 01 '13 14:08 ericsaupe

I put together a new set of styles that allow for Bootstrap 3 and Typeahead to play nicely. You can see them at https://gist.github.com/bhays/6140058

The width of the input field is still an issue. This is due to the inline-block style that gets applied to the twitter-typeahead element. It's possible to override the .twitter-typeahead display style with !important if needed.

bhays avatar Aug 02 '13 14:08 bhays

Thanks for doing that @bhays.

jharding avatar Aug 02 '13 18:08 jharding

+1 @bhays

Unfortunately, this still doesn't work great when using things like input group, as I'm doing.

apexskier avatar Aug 02 '13 18:08 apexskier

If anyone's interested, here's @bhays css modified to work with one very specific example: a large btn group.

http://jsfiddle.net/y3mZn/4/

edit: updated link

apexskier avatar Aug 02 '13 19:08 apexskier

The CSS by @apexskier unfortunately breaks if the textfield is not the first element in the input-group. It also does not work if compiled version of Bootstrap is used (need to use !important). Here is one that makes it works even when the textfield is not the first within input-group and I also threw in so that the border-radius is the right size even if .input-small is used.

http://jsfiddle.net/qrtua/1/

kuroe avatar Aug 04 '13 06:08 kuroe

The fix by @kuroe appears leaves the hint as large if default size or.input-sm. I'd be so grateful for a fix (it's beyond my skill)

See: http://jsfiddle.net/qrtua/2/

tom-dudman avatar Aug 09 '13 21:08 tom-dudman

@the-duddo I have no time to cook up a fix but from what I know it have to resort to jQuery to accommodate the change of different input size. What I did for my own website is that I tweaked the jQuery and let it add the class of .input-small/input-whatever to the text field .tt-hint IF there is the same class in the previous/following element.

kuroe avatar Aug 12 '13 01:08 kuroe

This works for me http://jsfiddle.net/needathinkle/MA7Ep/

ashleydw avatar Aug 16 '13 10:08 ashleydw

Thx @ashleydw, that worked great for me!

Marcpepe avatar Aug 17 '13 11:08 Marcpepe

Thx @ashleydw, works for me too!

nivesh2 avatar Aug 17 '13 13:08 nivesh2

@ashleydw It also works for me! Thanks a lot.

ErikSchierboom avatar Aug 20 '13 11:08 ErikSchierboom

@ashleydw looks great! thanks!

kand avatar Aug 22 '13 14:08 kand

How are you guys implementing this fix? Just overwriting all the css with @ashleydw css?

ArlingtonHouse avatar Aug 22 '13 15:08 ArlingtonHouse

No, I just put it in my own CSS file. Didn't modify any bootstrap css or anything.

kand avatar Aug 22 '13 16:08 kand

@ArlingtonHouse We are just putting it in our CSS file that is inherited site wide. We aren't touching either typeahead.js or Bootstrap's files.

ericsaupe avatar Aug 22 '13 16:08 ericsaupe

I forked the original css repo and submitted a pull request https://github.com/ashleydw/typeahead.js-bootstrap.css.

Example page here: https://rawgithub.com/ashleydw/typeahead.js-bootstrap.css/master/index.html

Hope it helps. I removed the less file as I'm not good at it. If anyone can contribute one, that'd be great.

ashleydw avatar Aug 22 '13 17:08 ashleydw

This works great in Chrome & Firefox, but is still broken in IE9 (the search textbox doesn't have 100% width). ie9

ocodia avatar Aug 27 '13 16:08 ocodia

@ashleydw That's a great fix, however the suggestion box doesn't come over the top of my navigation menu, it hides behind it...will try to fix

Edit: It's a bit yucky, but I changed the .navbar z-index to 1. That makes the typeahead dropdown overlay the navbar, but I duno, is it "the best way"?

ziali avatar Aug 27 '13 21:08 ziali