123

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.

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.

            
              <section class="ptb30 full-height flex">
		<div class="flex vertical-center full-w">
			<div class="relative clearfix full-w">
				<div class="search-area">
					<div class="container">
						<div class="row">
							<div class="col-xs-12">
								<div class="pb30">
									<h1 class="text-center wiki-logo">
										<span class="pr10"><i class="fa fa-eye text-danger" aria-hidden="true"></i></span>Wikipedia<span class="text-danger">viewer</span></h1>
										<p class="text-center text-xs"><em>by:</em> Dani Paolo S. Dullano</p>
								</div>
							</div>
						</div>
						<div class="row row-centered">
							<div class="col-sm-6 col-xs-12 col-centered">
								<form action="" class="pb30">
									<div class="input-group roundmeup bg-white input-group-bordered">
										<input id="searchBox" type="text" class="form-control trans-input" placeholder="Search">
										<span class="input-group-btn">
											<button type="button" id="search-me" class="btn btn-danger trans-btn"><i class="fa fa-search text-danger"></i></button>
										</span>
									</div>
								</form>			
							</div>
						</div>
					</div>
				</div>
				<div id="search-results" class="relative clearfix bg-danger-dark">
					<div class="absolute occupy ptb30">
						<div class="relative">
							<div class="container">
								<div class="row">
									<div class="col-xs-12">
										<p class="numOfresult"></p>
										<div class="pt15">
											<ul id="result-list" class=""></ul>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div id="search-empty" class="relative clearfix bg-danger-dark">
					<div class="absolute occupy pt30">
						<div class="relative">
							<div class="container">
								<div class="row">
									<div class="col-xs-12">
										<h1 class="text-center pb5"><i class="fa fa-frown-o" aria-hidden="true"></i></h1>
										<p class="text-center error-query">Your search is empty, please type in your search</p>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>	
	</section>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400italic,700,700italic);
@import url(https://fonts.googleapis.com/css?family=Poiret+One);

/* Custom Dimensions */

.full-height{
	height:100vh;
}

.full-width{
	width:100vw;
}

.full-w{
	width:100%;
}

/* FLEX */

.flex{
	display:flex;
}

.flex-vert{
	flex-direction:column;
}

.justify-center{
	justify-content: center;
}

.vertical-center{
	align-items:center;
}

/* Positioning */

.absolute{
	position:absolute;
}
.relative{
	position:relative;
}
.fixed{
	position:fixed;
}

/* Custom Background */
.bg-danger-dark{
	background:#a94442;
	color:#fff;
}
.bg-white{
	background:#fff;
	color:#000;
}

.bg-orange{
	background:#f4511e;
	color: #fff;
}

.bg-maroon{
	background:#a94442;
	color:#fff;
}

.bg-gray{
	background:#999;
	color: #fff;
}

.bg-gray-dark{
	background:rgba(0,0,0,0.7);
	color:#fff;
}

.bg-transdark{
	background:rgba(0,0,0,0.5);
}


.coverbg{
	background-size:cover !important;
	background-repeat:no-repeat !important;
	background-position: center center;
}

.occupy{
	top:0;
	left:0;
	right:0;
	bottom:0;
}

.dark-overlay{
	background:rgba(0,0,0,0.7);
	z-index:100;
	width:100%;
	height:100%;
}

.above-overlay{
	z-index:200;
}

.fixedbg{
	background-attachment: fixed !important;
}

.contactbg{
	background:url();
}

.aboutbg{
	background:url();
	
}

/* Custom Jumbotron */

.custom-jumbotron{
	padding: 100px 25px;
	margin-bottom:0;
}

/* Custom Well */

.custom-well{
	background:transparent;
}

/* Custom Carousel Fade*/

.carousel-control.right, .carousel-control.left {
    background-image: none;
    color: #fff;
}

.custom-indicators {
	position:relative;
	width:auto;
	margin:0 auto;
	padding:0;
	left:0;
	right:0;
	bottom:0;
}

.custom-indicators li.active {
    background-color: #fff;
}

.item h1 {
    font-style: italic;
}

.item span {
    font-style: normal;
}




/* Custom Carousel Button */
.custom-carousel-btn{
	position:relative;
}

/* Profile Pic */
.prof-pic{
	background:url("https://technopaintings.files.wordpress.com/2011/04/paolo-dullano-2.jpg?w=263&h=300");
	background-position:center center;
	background-size:cover;
	background-repeat:no-repeat;
}

/* Custom Sections */

.section{
	padding:60px 0px;
}

/* Custom Navbar */
.navbar-custom{
	margin-bottom:0;
	z-index: 9999;
    border: 0;
    font-size: 12px !important;
    /*line-height: 1.42857143 !important;*/
    letter-spacing: 4px;
    border-radius: 0;
    background:#a94442;
}

.navbar-nav li a:hover, .navbar-nav li.active a {
    color: #a94442 !important;
    background-color: #fff !important;
}

.navbar-custom .navbar-toggle {
    border-color: transparent;
    color: #fff !important;
}

.bg-transparent{
	background:transparent !important;
}

.portfolio_grid{
	margin-top:60px;
}

/* Custom Thumbnail */
.custom-thumbnail{
	padding:0px;
	background:transparent;
	border: none;
    border-radius: 0;
}

.custom-thumbnail .caption{
	background:#555;
	color:#fff;
}


/* Custom List */

.custom-list{
	margin-left:0px !important;
}

.plain-list{
	list-style: none;
	margin:0;
	padding:0;
}

.plain-list li{
	cursor:pointer;
}

.plain-list-horizontal{
	list-style: none;
	margin:0;
	padding:0;
}

.plain-list-horizontal li{
	cursor:pointer;
	/*display:inline-block;*/
	justify-content:center;
}

/* PERFECT SQUARE */

.squared{
	position: relative;
	width: 100%;
	overflow: hidden !important;
}

.squared:before{
	content:'';
	padding:50% 0px;
	display:inline-block;
}

.square-half{
	position: relative;
	width: 100%;
	overflow: hidden !important;
	/*background:#ddd;*/
}

.square-half:before{
	content:'';
	padding:25% 0px;
	display:inline-block;
}

.square-half > img{
	position: absolute;
	top: 0px;
	right: 0px;
	bottom: 0px;
	left: 0px;
	clip: inherit !important;
	margin: 0px auto;
}


/* PERFECT SQUARED PIC */
.squared-pic{
	position: relative;
	width: 100%;
	overflow: hidden !important;
	background:#ddd;
}

.squared-pic:before{
	content:'';
	padding:50% 0px;
	display:inline-block;
}

.squared-pic > img{
	position: absolute;
	top: 0px;
	right: 0px;
	bottom: 0px;
	left: 0px;
	clip: inherit !important;
	margin: 0px auto;
}

/* Custom Row and Column */
.row-centered{
	text-align:center;
}

.col-centered{
	display:inline-block;
    float: none;
    margin: 0 auto;
}

/* Results Container */
#search-results{
	border-top:1px solid #aaa;
	overflow-y:scroll;
	opacity:0;
	height:0;
	transition: all 0.5s ease;
	-moz-transition: all 0.5s ease;
	-ms-transition: all 0.5s ease;
	-o-transition: all 0.5s ease;
}

#search-results.active{
	opacity:1;
	height:50vh;
}


#result-list{
	list-style: none;
	margin:0;
	padding:0;
}

#result-list li{
	background:#fff;
	padding:10px 15px;
	margin-bottom:20px;
}

#result-list li:last-child{
	margin-bottom:0px;
}

#result-list li:hover{
	border-left:4px solid #ffcc00;
	cursor:pointer;
}

#result-list li > p{
	color:#353535;
}

#result-list li > a{
 	color:#357ab7 !important;	
}

.result-header{
	font-size:18px;
	color:#a94442;
}

#search-empty{
	opacity:0;
	border-top:1px solid #aaa;
	transition: all 0.5s ease;
	-moz-transition: all 0.5s ease;
	-ms-transition: all 0.5s ease;
	-o-transition: all 0.5s ease;	
}

#search-empty.active{
	opacity:1;
	height:50vh;
}

/* Custom Input */
.input-group-bordered{
	border:1px solid #aaa;
}
.trans-input {
    background: transparent;
    border: none;
    color: #353535;
    outline: none;
	box-shadow: none !important;
	border: none !important;
}

.trans-btn {
    background: transparent;
    border: none;
    color: #353535;
}

.trans-btn:hover,.trans-btn:active,.trans-btn:focus,.trans-btn:visited {
    background: transparent !important;
}

/* Custom Padding */

.nospace{
	padding:0;
	margin:0;
}

.pt15{
	padding-top:15px;
}

.pt20{
	padding-top:20px;
}

.pt25{
	padding-top:25px;
}

.pt30{
	padding-top:30px;
}

.pt60{
	padding-top:60px;
}

.pb15{
	padding-bottom:15px;
}

.pb20{
	padding-bottom:20px;
}

.pb25{
	padding-bottom:25px;
}

.pb30{
	padding-bottom:30px;
}

.pb60{
	padding-bottom:60px;
}

.ptb15{
	padding:15px 0px;
}

.ptb20{
	padding:20px 0px;	
}

.ptb25{
	padding:25px 0px;	
}

.ptb30{
	padding:30px 0px;	
}

.pr5{
	padding-right:5px;
}
.pr6{
	padding-right:6px;
}
.pr8{
	padding-right:8px;
}
.pr10{
	padding-right:10px;
}
.pr12{
	padding-right:12px;
}
.pr14{
	padding-right:14px;
}
.pr15{
	padding-right:15px;
}
.pr16{
	padding-right:16px;
}

.pl5{
	padding-left:5px;
}
.pl6{
	padding-left:6px;
}
.pl8{
	padding-left:8px;
}
.pl10{
	padding-left:10px;
}
.pl12{
	padding-left:12px;
}
.pl14{
	padding-left:14px;
}
.pl15{
	padding-left:15px;
}
.pl16{
	padding-left:16px;
}

.p15{
	padding:15px;
}

.p20{
	padding:20px;
}

/* Custom Margin */

.mt15{
	margin-top:15px;
}

.mt20{
	margin-top:20px;
}

.mt25{
	margin-top:25px;
}

.mt30{
	margin-top:30px;
}

.mt60{
	margin-top:60px;	
}

.mb15{
	margin-bottom:15px;
}

.mb20{
	margin-bottom:20px;
}

.mb25{
	margin-bottom:25px;
}

.mb30{
	margin-bottom:30px;
}

.mb60{
	margin-bottom:60px;
}

.mtb15{
	margin:15px 0px;
}

.mtb20{
	margin:20px 0px;	
}

.mtb25{
	margin:25px 0px;	
}

.mtb30{
	margin:30px 0px;	
}

/* Custom Border */

.roundmeup{
	border-radius:6px;
}

/* Custom Button */

.btn-transdark{
	background-color:rgba(0,0,0,0.5);
	color:#fff;
}
.btn-transdark:hover,.btn-transdark:active,.btn-transdark:visited,.btn-transdark:focus{
	background-color:rgba(0,0,0,0.7);
	color:#fff !important;
}

/* Custom Logo */
.wiki-logo{
	font-family: "Ubuntu Mono",;
}

/* TYPOGRAPHY */
.text-xs{
	font-size:12px;
}
.text-transdark{
	color:rgba(0,0,0,0.5);
}
.text-orange{
	color:#ff9900;
}

.text-yellow{
	color:#ffcc00;
}

.text-white{
	color:#fff;
}

.custom-quote{
	border:none;
	padding:0;
	margin:0;
	line-height:auto;
}

.custom-quote h1{
	font-weight:thin;
	color:#fff;
	margin:0;
	padding:0;
	font-family: 'Poiret One', cursive;

	/*animate*/
	-webkit-transition: opacity 0.5s ease-in-out;
	-moz-transition: opacity 0.5s ease-in-out;
	-ms-transition: opacity 0.5s ease-in-out;
	-o-transition: opacity 0.5s ease-in-out;
	transition: opacity 0.5s ease-in-out;

}

.custom-quote footer{
	margin-top:10px;
	font-weight:bold;
}


.sharelink .sm-circle{
	color:rgba(0,0,0,0.4);
}

.sharelink .sm-circle:hover{
	color:rgba(0,0,0,0.6);
}

.sharelink:hover{
	text-decoration:none; 
}

a{color:inherit !important;}

/* social media icons */
.sm-link{
	color:#fff;
	border:dotted 2px;
	border-radius:50%;
	width:46px;
	height:46px;
	display:flex;
	justify-content: center;
	align-items: center;
}

.sm-link:hover{
	color:#a94442 !important;
	text-decoration:none;
}

.sm-link i{
	font-size:20px;
}

/* Not Visible */
.notvisible{
	display:none;
}



            
          
!
            
              $(document).ready(function(){


	//on search button click
	$("#search-me").click(function(){
		
		var searchQuery = $("#searchBox").val();
		var wikiurl = "https://en.wikipedia.org/w/api.php?action=opensearch&search="+searchQuery+"&format=json&callback=?";		
		
		$.ajax( {
		    url: wikiurl,
		    //data: searchQuery,
		    async: true,
		    dataType: 'json',
		    type: 'GET',
		    //headers: { 'Api-User-Agent': 'Example/1.0' },
		    success: function(data) {
		    	if(searchQuery.length!=0){
		    		$("#search-empty").removeClass("active");
		    		$("#search-results").addClass("active");

		    		$("#result-list").html(""); // clear content


		    		var numResult = data[1].length;	// number of results
		    		var resultData = data[1]; // result data for checking purposes

		    		for(var i = 0; i<numResult;i++){ // for every result get each content
		    			
		    			$("#result-list").prepend('<li class="resultli"><h1 class="result-header">'+data[1][i]+'</h1><p>'+data[2][i]+'</p><a href="'+data[3][i]+'" target="_blank">'+data[3][i]+'</a></li>');	
		    		}

		    		if(numResult!=0){
		    			if(numResult==1){
		    				$(".numOfresult").html(data[1].length+" Result found"); // display number of results		
		    			}
		    			else if(numResult>=2){
		    				$(".numOfresult").html(data[1].length+" Results found"); // display number of results	
		    			}
	    			}
	    			else if(numResult==0 || resultData==" "){ // if zero results output an error message
	    				$(".numOfresult").html(numResult+" Result found"); // display number of results		
	    				$("#result-list").replaceWith("<h1 class='text-center'><i class='fa fa-frown-o' aria-hidden='true'></i></h1><p class='text-center'>Sorry "+searchQuery+" does not exist in our records try Google.</p>"); // if no results found
	    			}
		    		
		    		
					//On li click redirect
					$(".resultli").click(function(){
						var resultLink = $(this).find('a').attr("href");
						window.open(resultLink,'_blank');
					});

					console.log(numResult);
					console.log(resultData);

		    	}
		    	else{
		    		$("#search-results").removeClass("active");
		    		$("#search-empty").addClass("active"); // show error div
		    		$("#searchBox").focus(); // focus on the searchbox
		    	}
		    },
		    error: function(errorMessage){
		    	alert("Unable to connect");
		    }
		});

	});

	
	

});



            
          
!
999px
🕑 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.

Console