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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

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

Visit your global Editor Settings.

HTML

              
                <div class="container-fluid text-center" id="reset">
  <h1>Wikipedia Viewer</h1>
  <div class="s3arch center-block text-center">
    <a href="#" id="test">Search</a>
    <div class="stuff">
      <div class="text-center center-block">
          <div class="input-group" id="hmm">
            <input type="search" class="form-control" id="baa" placeholder="Search Wikipedia">
            <span class="input-group-btn">
        <button id="boo" class="btn btn-default" type="button">Go!</button>
      </span>
          </div>
        </div>
      </div>
</div>
    
  <div class="random">
    <button class="btn btn-default btn-primary text-center"><a href="https://en.wikipedia.org/wiki/Special:Random" target=_blank><span class="glyphicon glyphicon-random" aria-hidden="true"></span></a></button>
  </div>
  <a id="cout" name="cout"></a>
  <div id="output" class="contentwindow">
  </div>
</div>

              
            
!

CSS

              
                .random button a {
  color: white;
}

.random button {
  margin-top: 5px;
  border-radius: 15px;
}

.container-fluid {
  margin-left: 10%;
  margin-right: 10%;
}

.s3arch {
  margin-top: 5px;
  padding-top: 2px;
  border-style: solid;
  border-width: 1.5px;
  border-color: #999;
  border-radius: 17px;
  height: 30px;
  width: 100px;
}

.s3arch button {
  margin-top: 3.5px;
  margin-right: 4px;
  padding-top: 10px;
  border-width: 0px;
  border-radius: 11px;
  background: rgba(0, 0, 0, 0);
}

.stuff {
  display: none;
}

.form-control {
  margin-top: 3px;
  padding-top: 10px;
  border-width: 0px;
  background: rgba(0, 0, 0, 0);
}

input[type=search],
textarea {
  margin-top: 3.5px;
  margin-left: 5px;
  height: 36px;
  box-shadow: 0 0 0px rgba(81, 203, 238, 1);
  border-width: 0px;
  border-radius: 11px;
  background: #eee;
}

input[type=search]:focus,
textarea:focus {
  box-shadow: 0 0 0px rgba(81, 203, 238, 1);
  border-width: 0px;
}

.bs-callout {
  text-align: justify !important;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid #eee;
  border-left-width: 5px;
  border-radius: 10px;
  box-shadow: 5px 5px 5px #999;
}

.bs-callout h4 {
  margin-top: 0;
  margin-bottom: 5px;
}

.bs-callout p:last-child {
  margin-bottom: 0;
}

.bs-callout code {
  border-radius: 3px;
}

.bs-callout+.bs-callout {
  margin-top: -5px;
}

.bs-callout-primary {
  border-left-color: #428bca;
  color: #428bca;
  transition: .2s
}

.bs-callout-primary p1 {
  color: black !important;
}


.bs-callout-primary:hover {
  border-left-color: #5cb85c;
  color: #5cb85c;
  transform: scale(1.03);
  transition: .3s;
}

              
            
!

JS

              
                $(document).ready(function() {
  $("#test").click(function() {
    $(".s3arch").animate({
      width: "+=140",
      height: "+=20",
    }, 300);
    $("#test").hide();
    $(".stuff").show();
    $("#baa").focus();
    $("#baa").keydown(function(event) {
      if (event.keyCode == 13) {
        $("#boo").trigger("click");
      }
    });
    $("#reset").click(function(e) {
      if (e.target == this) {
        $("#test").show();
        $(".stuff").hide();

        $(".s3arch").animate({
          width: "70",
          height: "30",
        }, 300);

        $(".contentwindow").animate({
          "padding-top": ".5%"
        }, 300);
      }
    });

    $("#boo").on("click", function() {
      var url = "https://en.wikipedia.org/w/api.php?action=query&prop=info&inprop=url&list=search&srsearch=";
      var userSearch = $("#baa").val();
      userSearch = userSearch.replace(/\s+/g, "+");
      url += userSearch + "&format=json&callback=?";

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

      $(document.body).animate({
        'scrollTop': $('#cout').offset().top
      }, 1000);

      if (userSearch === "") {
        $("#boo").click(function(event) {
          event.preventDefault();
        });
      } else {
        $.getJSON(url, function(response) {
          console.log(response);
          var html = "";
          var url3 = "";
          if (response.query.searchinfo.totalhits === 0) {
            html += '<div class="bs-callout bs-callout-primary">';
            html += '<h4>Sorry</h4>';
            html += '<p1>Your search returned no results. Please check your spelling and try again. Or use <a id="igiveup" target=_blank>Google</a>.</p1></div>';
            $("#output").html(html);
            $("#igiveup").click(function(){
              $(this).attr("href", "https://www.google.com/search?q=" + userSearch);
            });
          } else {
            $.getJSON(url2, function(info) {
              console.log(info);
              var url3 = info[3];

             url3.forEach(function(val, val2) {

                html += '<a href="' + val + '" target=_blank><div class="bs-callout bs-callout-primary">';
                html += '<h4>' + info[1][val2] + '</h4>';
               html += '<p1>' + info[2][val2] + '</p1></div></a>';
              });
              $("#output").html(html);
            });
          }

        });
      }
    });
  });
});
              
            
!
999px

Console