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.

            
              main(ng-app='WikiApp' ng-controller='MainCtrl')
  #search.wrapper.fullHeight
    a.white-text(href='http://en.wikipedia.org/wiki/Special:Random' target='_blank') Click here for a random article
    br
    form(ng-submit='search()')
      input(type='text' ng-model='searchTxt')
      .eks
     p.white-text#help Click icon to search
  .wrapper
    ul
      a(ng-href='{{result.page}}' target='_blank' ng-repeat='result in results')
        li
          h1 {{result.title}}
          p {{result.body}}
            
          
!
            
              @import "bourbon";

@import url(https://fonts.googleapis.com/css?family=Rokkitt:700);

// Colors
$blue: #092B40;
$lightBlue: #85DEF2;
$water: #52A5D9;
$sky: #5BB5D9;
$orange: #D96F32;

* { 
  box-sizing: border-box;
}

html, body, main {
  font-family: "Lucida Grande","Lucida Sans Unicode", Tahoma, Sans-Serif;

  position: relatiave;
  margin: 0; padding: 0;
  padding-top: 10px;
  width: 100%; height: 100%;
  background-color: $blue;
}

input[type='text'] {
  -webkit-appearance: none;
  outline: none;
  border: none;
}

.wrapper {
  display: flex;
  width: 100%;
  @include display(flex);
	@include flex-direction(column);
	@include align-items(center);
	@include justify-content(center);
  @include transition(all 2s linear);
}

.fullHeight { 
  height: 100%; 
  @include transition-duration(2s);
}

.white-text {
  color: white;
  text-decoration: none;
}

form {
  position: relative;
  display: block;
  z-index: 1;
  width: 40px;
  height: 40px;
  margin-left: 0;
  padding: 0;
  margin-bottom: 10px;
  border: 4px solid $orange;
  border-radius: 20px;
  
  @include transition(all .25s ease .3s);
  cursor: pointer;
  &:before {
    @extend %def;
    top: 90%;
    left: 90%;
    width: 16px;
    height: 3px;
    background-color: $orange;
    border-radius: 1px;
    @include transition(width .15s ease .55s);
    @include transform(rotate(45deg));
    @include transform-origin(top left);
  }
  input {
    width: 100%;
    height: 100%;
    padding: 0 30px 0 15px;
    font-size: 14px;
    line-height: 38px;
    opacity: 0;
    background-color: transparent;
    color: white;
    @include transition(opacity .15s ease);
  }
}

.eks {
	display: block;
	position: absolute;
	top: 50%;
	right: 0;
	z-index: 20;
	width: 30px;
	height: 30px;
	cursor: pointer;	
	@include transform(translateY(-50%));
	&:before, &:after {
		@extend %def;
		right: 5px;
		height: 2px;
		width: 2px;
		border-radius: 1px;
		@include transition(all .25s ease);
	}
	&:before {
		top: 0px;
		background-color: $orange;
		@include transform(rotate(-45deg));
		@include transform-origin(top right);
		@include transition-delay(.1s);
	}
	&:after {
		bottom: 0px;
		background-color: $orange;
		@include transform(rotate(45deg));
		@include transform-origin(bottom right);
		@include transition-delay(0s);
	}
}

form.open {
  width: 260px;
  @include transition-delay(.1s);
  &:before {
    width: 0px;
    @include transition-delay(0s);
  }
  input {
    opacity: 1;
    @include transition-delay(.15s);
  }
  .eks {
    &:before, &:after {
      width: 15px;
      right: 12px;
    }
    &:before {
      top: 9px;
      @include transition-delay(.25s);
    }
    &:after {
      bottom: 9px;
      @include transition-delay(.3s);
    }
  }
}

ul {
  margin-left: 0; padding-left: 0;
  width: 80%;
  
  a {
    text-decoration: none;
    color: black;
    
    h1 {
      font-size: 18px;
    }
    p {
      font-size: 14px;
    }
  }
  li {
    list-style-type: none;
    display: block;
    margin-bottom: 10px;
    padding: 15px 30px 5px 30px;
    background-color: #E7E7E8;
    opacity: 0;
    @include animation(new-item 1s ease-in-out forwards);
    @include transition-timing-function(cubic-bezier(0.6, 0, 0.4, 1.0));

    &:hover {
      border-left: 5px solid $orange;
      margin-left: -5px;
      //box-shadow: inset 2px -2px 0 $orange;
    }
  }
}

.hide {
  display: none;
}

%def {
  content: '';
  position: absolute;
  display: block;
}

@include keyframes(new-item) {
  0% { opacity: 0; 
    -webkit-transform: translateY(2000px); }
  80% { opacity: 0; }
  100% { opacity: 1;
    -webkit-transform: translateY(0); }
}
            
          
!
            
              var app = angular.module('WikiApp', ['ngAnimate']);
app.controller('MainCtrl', function($scope, $http, $timeout) {
  var form = $('form');
  var close = $('.eks');
  var input = $('input');
  var search = $("#search");
  var help = $("#help");
  
  $scope.results = [];

  close.on('click', function() {
    form.toggleClass('open');
    
    if (!form.hasClass('open') && $scope.searchTxt !== '' && typeof $scope.searchTxt !== 'undefined') {
	    search.toggleClass('fullHeight')
      help.toggleClass('hide');
      $scope.searchTxt = '';
    } 
    $scope.results = [];
    $scope.$apply();
  })

  input.on('transitionend webkitTransitionEnd oTransitionEnd', function() {
    if (form.hasClass('open')) {
      input.focus();
    } else {
      return;
    }
  })

  $scope.search = function() {
    $scope.results = [];
    help.addClass('hide');
    search.removeClass('fullHeight');
    var title = input.val();
    var api = 'http://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=';
    var cb = '&callback=JSON_CALLBACK';
    var page = 'http://en.wikipedia.org/?curid=';
    
    $http.jsonp(api + title + cb)
    .success(function(data) {
      var results = data.query.pages;
      angular.forEach(results, function(v,k)  {
        $scope.results.push({title: v.title, body: v.extract, page: page + v.pageid})
      })
    });
  }
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console