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 class="container">
  <div class="middle">
    <h1 class="center-me">Wikipedia Viewer</h1>
    <br>
    <img src="http://54.152.253.14/hostedImages/wikiViewer/globe.png" class="img-responsive center-me" alt="Responsive image">
    <div class="row">
      <div class="form-group">
        <input class="form-control search" id="userInput">
      </div>
      <div class=" text-center">
        <button type="button" id='search' class="btn btn-default buttons">Search</button>
    <a href="https://en.wikipedia.org/wiki/Special:Random" target="_blank">         <button type="button" id='search' class="btn btn-default buttons">Random</button></a>

      </div>
    </div>
    <div>
    </div>


    <!-- <div class="searchResult">
  <h2>Bugs,Bug Pictures,Insects -National Geographic</h2>
  <a href="https://www.deeson.co.uk/blog/ux-series-basic-principles-designing-search-results">https://www.deeson.co.uk/blog/ux-series-basic-principles-designing-search-results</a>
  <p>Learn all you wanted to know about bugs with <picture></picture>s, videos, photos, facts, and news from National Geographic</p>
 </div>     -->
  </div>
            
          
!
            
              
.center-me {
  margin: 0 auto;
  text-align:center; 
  margin-top:0%;
   
}
/* #search-container {
  margin: 0.5em auto 0 auto;
  min-width: 15em;
  max-width: 600px;
}
 */
.color{
    background-color:red;
  
}
.search {
  
   margin: 0.5em auto 0 auto;
   width: 75px;
   -webkit-transition: all .5s ease;
   -moz-transition: all .5s ease;
   transition: all .5s ease;
}
.buttons{
   margin-top:10px;
   margin-bottom:120px;
}
.search-expand{
   width: 450px;

}
a {
    color:#000000 !important;
    text-decoration:none;

}
.searchResult:hover{
 -webkit-transition: all .5s ease;
   -moz-transition: all .5s ease;
   transition: all .5s ease;
  color:red;
  
}
.searchResult{
   height:100px;
    width:100%;
    border: 2px solid #a1a1a1;
    border-radius: 4px;
    background: #dddddd;
   -webkit-box-shadow: 0 10px 6px -6px #777;
       -moz-box-shadow: 0 10px 6px -6px #777;
            box-shadow: 0 10px 6px -6px #777;
    
     margin: 0.5em auto 0 auto;
     margin-top:0px

}
.first-div{
  margin-top:-50px;
  
}
.title{   
  font-size:1.6em;
  font-family:"Linux Libertine",Georgia,Times,serif;
  
}
.middle{
  margin-top:25%;  
  
}

/* .searchResult{
  text-align:center;
  
} */

            
          
!
            
              $(document).ready(function() {
  $('#userInput').hover(function(){
     
      $('#userInput').addClass('search-expand');
     $('#userInput').off();
       
    
  });
  $('#search').click(function() {
    wikiSearch();
   
    

  });
  $(document).keypress(function(e) {
    if(e.which == 13) {
        wikiSearch();
    }
});

  var wikiSearch = function() {
    var searchTerm = $('#userInput').val();

    var url = "https://en.wikipedia.org/w/api.php?action=opensearch&search=" + searchTerm + "&format=json&callback=?";

    var wikiJson = $.getJSON(url);
   
    
    return displayWikiSearch(wikiJson);
   

  };

  var displayWikiSearch = function(wikiJson) {
    
      wikiJson.done(function(data){
          console.log(data);
          for(var i=0; i<data[1].length; i++){
         
    $('<a href="'+data[3][i]+'"><div class="searchResult"><h4 class="title">'+data[1][i]+'</h4>'+'<p>'+data[2][i]+'</p></div></a>').appendTo('.container');
            
          }
          console.log(data[3]);
        
      });
    
    $('.searchResult').slideUp('slow');
    
  };
  $("#randomLink").click(function(){
    window.location.href = "www.google.com";
    
  });
});
            
          
!
999px
Loading ..................

Console