cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              link(href='https://fonts.googleapis.com/css?family=Roboto', rel='stylesheet', type='text/css')
link(rel="stylesheet",href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css")

h1 Search input + animated suggestions
h2 Animation in Sass, simple script in CoffeeScript

.search-container
  .search-box
    .search-icon
      i.fa.fa-search
    input.search-input#search(type="text", placeholder="Search people")
    ul.search-results#results
            
          
!
            
              // Importing bourbon to make things easy: http://bourbon.io/
@import "bourbon"

// Useful mixins
@mixin border-radius($radius: 4px)
  @include prefixer(border-radius, $radius, webkit moz spec)
    
@mixin box-sizing($box-model)
  @include prefixer(box-sizing, $box-model, webkit moz spec)
    
/* General styles */

body
  background-color: white
  font-family: 'Roboto', Arial, sans-serif
  text-align: center
  padding-top: 30px
  font-size: 14px
  
h1
  font-size: 1.5em
  color: #666666
  
h2, a
  font-size: 0.8em
  color: #9BC788
  
h3
  color: #999
  margin-top: 40px

/* ============================ */
/* VARIABLES                    */
/* ============================ */
  
$color-primary: #9BC788
$search-width: 400px
$search-icon-width: 32px
$search-height: 40px
$visible-results: 5
/* ============================ */
/* SEARCH BAR                   */
/* ============================ */
  
.search-container
  margin: 40px auto
  width: $search-width
  
.search-box
  @include border-radius(3px)
  background-color: #f2f2f2
  height: $search-height
  position: relative
  
.search-icon
  @include box-sizing(border-box)
  float: left
  width: $search-icon-width
  height: $search-height
  color: #999
  font-size: 1.3em
  padding: 7px 15px
  
.search-input
  @include box-sizing(border-box)
  width: $search-width - $search-icon-width
  height: $search-height
  float: right
  background-color: transparent
  border: 0px
  padding: 10px
  text-transform: uppercase
  font-family: 'Roboto', Arial, sans-serif
  font-size: 1em
  position: relative
  outline: 0px
  
//useful for animation
@include keyframes(fadeInTop)
  0%
    opacity: 0
    @include transform(translateY(-1.334em) translateZ(0))
  100%
    opacity: 1

@mixin fadeInTop($dur: 1s, $delay: 0s, $fill: forwards)
  @include prefixer(animation, fadeInTop $dur $delay $fill, webkit spec)

.search-results
  list-style: none
  margin: 0
  padding: 0
  position: absolute
  z-index: 999
  width: $search-width - $search-icon-width
  max-height: $search-height * $visible-results
  overflow: scroll
  top: $search-height
  left: $search-icon-width
  text-align: left
  li
    @include box-sizing(border-box)
    padding: 10px
    height: $search-height
    background-color: $color-primary
    color: white
    font-weight: bold
    &:hover
      background-color: darken($color-primary, 7%)
      cursor: pointer
    /* ANIMATION */
    /* remove this part if you dont like the animation */
    @for $i from 1 through $visible-results
      &:nth-child(#{$i})
        /* Animation */
        @include fadeInTop(0.4s, (($i - 1)/10) * 1s )
        opacity: 0
    /* END OF ANIMATION */
  
            
          
!
            
              names = [
  "Gentry",
  "Brandi",
  "Maryann",
  "Tina",
  "Harper",
  "Hayes",
  "Tamera",
  "Shauna",
  "Mcfarland",
  "Charles",
  "Ortiz",
  "Maynard",
  "Julie",
  "Gay",
  "Wiggins",
  "Navarro",
  "Hopkins",
  "Candace",
  "Tammi",
  "Horton",
  "Erna",
  "Mills",
  "Opal",
  "Wolfe",
  "Walter",
  "Bonita",
  "Eleanor",
  "Rojas",
  "Ochoa",
  "Kirk",
  "Rosario",
  "Ball",
  "Lucile",
  "Kayla",
  "Carmela",
  "Miranda",
  "Middleton",
  "Lillie",
  "Sherry",
  "Jacqueline",
  "Deirdre",
  "Mueller",
  "Debra",
  "Jodi",
  "Joyce",
  "Estrada",
  "Liz",
  "Justine",
  "Francis",
  "Benton",
  "Henrietta",
  "Elise",
  "Lang",
  "Morse",
  "Farrell",
  "Tamra",
  "Darla",
  "Amy",
  "Kristie",
  "Wyatt",
  "Mcbride",
  "Talley",
  "Fay",
  "Sweet",
  "Fern",
  "Mcintosh",
  "Clemons",
  "Travis",
  "Kirsten",
  "Rios",
  "Newman",
  "Cook",
  "Jocelyn",
  "Mcmillan",
  "Mona",
  "Bessie",
  "Francis",
  "Rosemary",
  "Beverly",
  "Chandra",
  "Luella",
  "Parrish",
  "Ronda",
  "Earlene",
  "Bright",
  "Guthrie",
  "Shana",
  "Theresa",
  "Wells",
  "Green",
  "Schroeder",
  "Russo",
  "Randolph",
  "Livingston",
  "Carroll",
  "Velasquez",
  "Dana",
  "Bridget",
  "Hines",
  "Martha",
  "Marci",
  "Fuentes",
  "Stuart",
  "Glass",
  "Alejandra",
  "Thornton",
  "Britt",
  "Jeri",
  "Leach",
  "Cleo",
  "Lela",
  "Mattie",
  "Bonnie",
  "Lucille",
  "Mamie",
  "Kelly",
  "Obrien",
  "Carol",
  "Murphy",
  "Isabella",
  "Lowery",
  "Odom",
  "Norris",
  "Mullins",
  "Florine",
  "Morales",
  "Frederick",
  "Reynolds",
  "Janine",
  "Joyce",
  "Dean",
  "Marcy",
  "Allison",
  "Rena",
  "Saundra",
  "Flossie",
  "Kristi",
  "Monica",
  "Molina",
  "Guzman",
  "Loretta",
  "Levine",
  "Oneill",
  "Mccray",
  "Mann",
  "Constance",
  "English",
  "Eula",
  "Butler",
  "Erika"
]

# Match words in a collection
findAll = (wordList, collection) =>
  collection.filter (word) ->
    word = word.toLowerCase()
    wordList.some (w) -> ~word.indexOf w

# Displays results in a list
displayResults = (resultsEl, wordList) ->
  resultsEl.innerHTML = (wordList.map (w) -> '<li>'+w+'</li>').join ''

# Handle keyboard events
searchInput = document.getElementById 'search'
resultsOutput = document.getElementById 'results'
maxResults = 7

searchInput.addEventListener 'keyup', (e) =>
    value = searchInput.value.toLowerCase().split ' '
    suggested = (if value[0].length then findAll value, names else [])
    displayResults resultsOutput, suggested
            
          
!
999px
Loading ..................

Console