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 Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

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.

            
              <div id="container">
	<div id="logo">
		<p>Country<span>Search</span></p>
	</div>
	<div id="continput">
		<div id="input-group">
			<input type="text" id="searchtext">
			<button id="icon-src"><i class="fa fa-search" aria-hidden="true"></i></button>
		</div>
	</div>
	<ul id="results"></ul>
	<div id="header"></div>
</div>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic);

body {
	background: linear-gradient(to left, #FF00C7 0%,#00c7ff 100%);
}

#container {
	width: 350px;
	height: 600px;
	border-radius: 0px;
	overflow: hidden;
	margin: auto;
	position: absolute;
	border-top: 4px solid tomato;
	background: #1E202B;
	top:calc(50% - 300px);
	left:calc(50% - 175px);
}

#header {
	background: #35394A;
	width: 100%;
	height: 100%;
	text-align: center;
	position: relative;
	z-index: 1;
	transition: 400ms ease-out;
}

#header.focus0 {
	height: 15% !important;
}

#continput {
	position: absolute;
	width: 100%;
	height: 100%;
	background: transparent;
	padding-left: 50px;
	padding-right: 50px;
	box-sizing: border-box;
	transition: 150ms cubic-bezier(0, 2.15, 0.97, 0.36);
	transition-delay: 500ms;
}

#continput.focus1 {
	padding-left: 25px !important;
	padding-right: 25px !important;
}

#input-group {
	width: 100%;
	height: 50px;
  background: #1B1B1D;
	border-radius: 3px;
	position: relative;
	z-index: 2;
	top: 320px;
	overflow: hidden;
	transition: top 350ms ease-in-out;
}

#input-group.focus2 {
	top: 70px !important;
}

#searchtext {
	width: 100%;
	height: 100%;
	border: none;
	outline: none;
	font-family: 'Roboto';
	font-weight: 100;
	font-size: 22px;
	padding: 10px;
	padding-right: 50px;
	box-sizing: border-box;
	background: #1B1B1D;
	color: #ccc;
}

#icon-src {
	position: absolute;
	top: 11px;
	right: -30px;
	border: none;
	background: transparent;
	font-size: 20px;
	cursor: pointer;
	color: #999;
	outline: none;
	transition: 150ms cubic-bezier(0.53, 0.88, 0.72, 1.26);
	transition-delay: 500ms;
}

#icon-src.focus3 {
	right: 10px !important;
	color: #999 !important;
}

#logo {
	position: absolute;
	top: 230px;
	z-index: 2;
	left: 30px;
	transition: 300ms cubic-bezier(0.96, 1.11, 0.86, 1.13);
	transition-delay: 150ms;
}

#logo.focus4 {
	top: 17px;
	transform: scale(0.6);
	transition-delay: 0ms;
}

#logo p {
	font-family: 'Roboto';
	text-transform: uppercase;
	font-weight: 900;
	color: #fff;
	font-size: 35px;
	margin: 0;
}

#logo p span {
	font-weight: 100;
	font-style: italic;
}

#results {
	position: absolute;
	left: 25px;
	top: 135px;
	width: 300px !important;
	background: transparent;
	border-radius: 3px;
	margin: 0;
	padding: 0;
	list-style-type: none;
	box-sizing:border-box;
	opacity: 0;
	transition: 100ms ease-in;
}

#results li {
  background: #1B1B1D;
	padding: 5px 10px 5px 10px;
	transition: 200ms ease-in;
}

#results li:first-child {
	padding-top:10px;
	border-radius:3px 3px 0 0;
}

#results li:last-child {
	padding-bottom:10px;
	border-radius:0 0 3px 3px;
}

#results li a {
	color: #999;
	text-decoration: none;
	font-family: 'Roboto';
	font-weight: 100;
	font-size: 20px;
}

#results li a:hover {
	color: tomato;
}

#results.visible{
	opacity: 1 !important;
}
            
          
!
            
              var contInput = document.getElementById('continput');
var gInput = document.getElementById('input-group');
var input = document.getElementById('searchtext');
var button = document.getElementById('icon-src');
var logo = document.getElementById('logo');
var results = document.getElementById('results');
var redBg = document.getElementById('header');

var element = [redBg, contInput, gInput, button, logo, results];

input.addEventListener('focus', function(){
	for (var i = 0; i < element.length; i++) {
	element[i].classList.add('focus' + i);
	}
}, false);

input.addEventListener('blur', function(){
	for (var i = 0; i < element.length; i++) {
	element[i].classList.remove('focus'+ i);
	}
}, false);

input.addEventListener('keyup', function(){
	if (results.childNodes.length === 0) {
		results.classList.remove('visible');
	} else {
	results.classList.add('visible');
	}
},false);

/* jquery for autocomplete*/

jQuery(document).ready(function($) {

  $("#searchtext").keyup(function() {
    getAutoCompleteValues($("#searchtext").val());
  });

});

function getAutoCompleteValues(val) {

  $.ajax({
    dataType: "jsonp",
    jsonp: "cb",
    cache: 'false',
    // jsonpCallback: "callback",
    url: "http://autocomplete.wunderground.com/aq?query=" + val + "&format=json",
    // cache: false,
    success: function(data) {
      // alert(data);
      if (val == "") {
      $("#results").html('');
      $("#results").removeClass('result');}
  		else {
      $("#results").html('');
      $("#results").addClass('result');
	for (var i = 0; i < 8; i++) {
	  var city = data.RESULTS[i]['name'];
	  $("#results").append('<li><a href="#">'+city+'</a></li>'); 
	}
}
    }
  });
}
            
          
!
999px
Loading ..................

Console