Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jquery_typeahead.md with styling example #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions doc/jquery_typeahead.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,58 @@ $('.typeahead').typeahead({
}
});
```

### Styling

You can use whatever css styling with the library. Here's an [example snippet](https://stackoverflow.com/questions/60891269/typeahead-js-cant-find-the-styling-to-modify-it-or-can-i-override-an-html-eleme):

```css
<style>
*****************************
* Twitter Typeahead Styling *
*****************************/
.typeahead {
width: 100%;
}

.tt-hint {
color: #999;
}

.tt-menu {
width: 422px;
margin-top: 4px;
padding: 4px 0;
color: black;
background-color: #eee;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
box-shadow: 0 5px 10px rgba(0,0,0,.2);
}

.tt-suggestion {
padding: 3px 20px;
line-height: 24px;
}

.tt-suggestion:hover {
background-color: #ddd;
}

.tt-suggestion p {
margin: 0;
}

.tt-suggestion.tt-cursor {
color: #fff;
background-color: #0097cf;
}
</style>
```