Last active
December 28, 2015 22:09
-
-
Save lenagroeger/7569231 to your computer and use it in GitHub Desktop.
Typeahead Autofill AutoComplete
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript" src="http://propublica.s3.amazonaws.com/projects/projectx/jquerytypeahead.js"></script> | |
| <script type="text/javascript"> | |
| propublica.views.nameTypeahead = propublica.View.extend({ | |
| tag : "input", | |
| cssClass : "name_typeahead", | |
| render : function(){ | |
| var typeaheadName = [ | |
| "some name", | |
| "some other name", | |
| "some more name", | |
| "some extra name", | |
| "some final name" ] | |
| this.el.typeahead({source : typeaheadName, items : 8}); | |
| } | |
| }); | |
| </script> | |
| <style> | |
| /* typeahead */ | |
| .typeahead { | |
| margin-top: 2px; | |
| -webkit-border-radius: 4px; | |
| -moz-border-radius: 4px; | |
| border-radius: 4px; | |
| } | |
| .dropdown-menu { | |
| position: absolute; | |
| top: 100%; | |
| left: 0; | |
| z-index: 1000; | |
| float: left; | |
| display: none; | |
| min-width: 160px; | |
| padding: 4px 0; | |
| margin: 0; | |
| list-style: none; | |
| background-color: #ffffff; | |
| border-color: #ccc; | |
| border-color: rgba(0, 0, 0, 0.2); | |
| border-style: solid; | |
| border-width: 1px; | |
| -webkit-border-radius: 0 0 5px 5px; | |
| -moz-border-radius: 0 0 5px 5px; | |
| border-radius: 0 0 5px 5px; | |
| -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); | |
| -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); | |
| box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); | |
| -webkit-background-clip: padding-box; | |
| -moz-background-clip: padding; | |
| background-clip: padding-box; | |
| border-right-width: 2px; | |
| border-bottom-width: 2px; | |
| } | |
| .dropdown-menu.pull-right { | |
| right: 0; | |
| left: auto; | |
| } | |
| .dropdown-menu .divider { | |
| height: 1px; | |
| margin: 8px 1px; | |
| overflow: hidden; | |
| background-color: #91ADD1; | |
| border-bottom: 1px solid #ffffff; | |
| *width: 100%; | |
| *margin: -5px 0 5px; | |
| } | |
| .dropdown-menu a { | |
| display: block; | |
| padding: 3px 15px; | |
| clear: both; | |
| font-weight: normal; | |
| line-height: 18px; | |
| color: #000; | |
| white-space: nowrap; | |
| font-family:"Helvetica",arial,sans-serif; | |
| } | |
| .dropdown-menu li > a:hover, | |
| .dropdown-menu .active > a, | |
| .dropdown-menu .active > a:hover { | |
| color: #ffffff; | |
| text-decoration: none; | |
| background-color: #91ADD1; | |
| } | |
| input[type="text"] { | |
| width: 100%; | |
| border-radius: 4px; | |
| height: 20px; | |
| font-size: 13px; | |
| font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
| -webkit-box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.3); | |
| -moz-box-shadow: inset 0 0px 0px rgba(0,0,0,0.3); | |
| box-shadow: inset 0 0px 0px rgba(0, 0, 0, 0.3); | |
| border: 1px solid #dedede; | |
| padding: 4px 5px; | |
| background: url("http://propublica.s3.amazonaws.com/images/mag_glass.svg") no-repeat top left; | |
| background-size: 25px 25px; | |
| padding-left: 30px; | |
| } | |
| </style> | |
| <div class="filter_box"><input id="filterable_name_main" data-provide="typeahead" type="text" placeholder="Look Up A Name" class="name_typeahead filterable"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment