Pen Settings

HTML

CSS

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.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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.

+ add another resource

Behavior

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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

            
              <div class="container">
  <div class="row text-center afterMe">
    <div class="col-md-4"></div>
    <div class="col-md-4 v-align">
      <p><button class="btn btn-default btn-wiki" id="randomArticle"><i class="fa fa-question-circle-o" aria-hidden="true"></i> Random article</button></p>
      <p>Click icon to search or select random article above.</p>
      <h2><i class="fa fa-search fa-2" aria-hidden="true"></i><input type="text" id="search" class="search" /><a href="#" id="closeIcon">x</a></h2>
      <p><button class="btn btn-default btn-wiki" onclick="searchWikipedia();">Search <i class="fa fa-wikipedia-w" aria-hidden="true"></i>ikipedia!</button></p>
    </div>
    <div class="col-md-4"></div>
  </div>
    
</div>

            
          
!

CSS

            
              $grey: #DEE8EF
$orange: #E7983F
$teal: #26899E
$dark-grey: #3E4154
$brown: #948173

body
  color: $grey
  background-color: $teal
#closeIcon
  font-size: 0.5em
  left: -20px
  position: relative
  color: $orange
  display: none
  text-decoration: none
  top: 0px
.fa-search
  color: $orange
  cursor: pointer
  font-size: 1.25em
.btn-wiki 
  background-color: $grey
  color: $orange  
  margin-top: 10px
  &:hover
    color: $orange
    background-color: $dark-grey
input
  outline: none
#search
  border-radius: 25px
  border: 5px $orange solid
  background-color: $teal
  display: none
  font-size: 0.50em
  margin: 0 0 10px 0
  outline:none
  padding: 15px 20px 15px 15px
  width: 25px
  height: 25px  
.wikiResults
  margin: 0 0 25px 0
  text-align: left
  background-color: $dark-grey
a
  color: $grey
  &:hover
    color: $grey
  &:visited
    color: $grey
  &:active
    color: $grey
  &:link
    color: $grey    
  h1
    font-size: 1.75em
    font-weight: bold
  p
      
    
      
    
  
            
          
!

JS

            
              $(".fa-search").click(function(){
  
  $(this).hide();
  $("#search").show();
  $("#search").animate({
    width: "200px"
  }, 500);
  //console.log("Test");
  $("#closeIcon").show("slow");
  $("#search").focus();
});

$("#search").keypress(function(event){
  if(event.which === 13){
    searchWikipedia();    
  }
});

$("#closeIcon").click(function(){
  $("#search").animate({
    width: "25px"
  }, "slow", function(){
    $("#search").hide().val("");
    $(".wikiResults").fadeOut("slow", function(){
      $(".wikiResults").remove();
    });
    $(".fa-search").show();
    $("#closeIcon").hide();     
  });
});

function searchWikipedia(){
  $.ajax({
        url: "https://en.wikipedia.org/w/api.php",
        jsonp: "callback",
        dataType: 'jsonp',
        data: {
          action: "query",
          list: "search",
          srsearch: $(".search").val(),
          srinfo: "suggestion",
          srlimit: "10",
          format: "json"
        },
        xhrFields: {
          withCredentials: true
        },
        success: function(data){
          //console.log(data.query.search)
          $(".wikiResults").remove();
         var wikiToAppend="";
          for(var i=0;i<10;i++){
            wikiToAppend+="<a href='https://en.wikipedia.org/wiki/"+ data.query.search[i].title +"' target='_blank'><div class='row wikiResults'><div class='col-md-12'><h1 class='wikiTitle'>" + data.query.search[i].title + "</h1><p class='wikiDesc'>" + data.query.search[i].snippet + "</p></div></div></a>"
          }
         $(wikiToAppend).fadeIn("slow").appendTo(".container");       
   $(window).scrollTop(205);     
  $(".wikiResults").hover(function(){
    $(this).css("border-left", "5px solid #DEE8EF");
  },function(){
    $(this).css("border-left", "0");
  });      
        }
        
        
      });

}

$('#randomArticle').click(function(){
    window.open('https://en.wikipedia.org/wiki/Special:Random');
});

            
          
!
999px

Console