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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

              <!--Codepen.io does not allow Wiki API autocomplete functionality -->
<!--The app is in a working state, and is available at https://github.com/ruskam/wikipedia-search-->

    <div class="container-fluid">
        <div class="row">
            <div class="col-md-6 col-md-offset-3 text-center header-page">
                <h1>Wikipedia Viewer</h1>
            <div class="col-md-3 text-left header-page">

                        <a href="https://en.wikipedia.org/wiki/Special:Random" target="_blank">
                            <div class="fa fa-wikipedia-w rotate" title="Click to open a random article"style="color:silver;">




        <div class="row">
            <div class="form-area">
                <div class="col-md-6 col-md-offset-3 text-center">
                    <form id="form-container" class="form-container">
                        <div class="input-group input-group-lg" method="get" id="form-search">
                            <input type="text" class="form-control" id="search-input" autofocus>
                            <div class="input-group-btn">
                                <button class="btn btn-default" type="submit">
                            <i class="glyphicon glyphicon-search"></i>

        <div class="wiki-results-container">
            <div class="row">
                <div class="col-md-6 col-md-offset-3">
                    <ul class="list-group list-group-hover" id="wiki-results">
                        <!--div id="wiki-results"></div-->
              body {
    padding-top: 20px;
    width: 100%;
    height: 100%;
    /*background-image: url("https://source.unsplash.com/XJXWbfSo2f0/1600x900");*/
    background-image: /*url("https://source.unsplash.com/68ZlATaVYIo/1600x900");*/

    color: white;
    font-family: monospace;

.form-area {
    margin-top: 20px;

.wiki-results-container {
    margin-top: 20px;

.list-group-hover .list-group-item:hover {
    background-color: #F4F1DE;
    color: black;

    color: black;
    font-size: 17px;
    font-weight: bold;

.article-description {
    color: grey;
    font-size: 13px;
    -moz-transition: all 2s linear;
    -webkit-transition: all 2s linear;
    transition: all 2s linear;

.rotate .around{

              $(document).ready(function() {

    // enableAutocomplete();
        source: function(req, res) {
                url: "http://en.wikipedia.org/w/api.php",
                dataType: "jsonp",
                data: {
                    'action': "opensearch",
                    'format': "json",
                    'search': req.term
                success: function(data){

function search(){
    var $wikiResultsElement = $('#wiki-results');
    var input = encodeURIComponent(($("#search-input").val()).trim());

    console.log("input is: ", input);
    var wikiRequestTimeout = setTimeout(function(){
            //$wikiElem.text("Failed getting Wiki resources");
        }, 10000);

    var wikiUrl ='http://en.wikipedia.org/w/api.php?action=opensearch&search=' + input + '&format=json';

        url: wikiUrl,
        dataType: "jsonp",
        jsonp: "callback",
        success: function(response) {
            console.log('response', response);
            var resultList = response[1];
            var descriptionList = response[2];
            var urlList = response[3];
            if (typeof resultList !== 'undefined' && resultList.length > 0) {
                for (var i = 0; i < resultList.length; i++) {
                    var articleTitle = resultList[i];
                    var articleDescription = descriptionList[i];
                    var articleUrl = urlList[i];
                    $wikiResultsElement.append('<a href="' + articleUrl + '"class="list-group-item list-group-item-action" target="_blank">' + '<span class="article-title">' + articleTitle + '</span>' + '<br>' + '<span class="article-description">' + articleDescription + '</span></a></li><br>');



    return false;


    $(this).toggleClass("around")  ; 

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................