LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

RandomUserWall

A jQuery Plugin to build a wall of random user faces.

Download GitHub

by Mike Zarandona

CSS
body {
  text-align: center;
  background-color: #111;
  position: relative;
  font: 400 16px/1.5em 'Open Sans', sans;
}
.wall {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  z-index: 0;
}
.wall img {
  margin: 0 0 -5px 0;
  display: inline-block;
  width: 14.285%;
  z-index: 0;
  position: relative;
}
.wall:after {
  content: '';
  display: block;
  position: fixed;
  top: 0;
  height: 100%;
  left: 0;
  width: 100%;
  z-index: 20;
  background: rgba(255, 255, 255, 0.2);
  background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.6) 70%, rgba(255, 255, 255, 0.98) 100%);
  background: linear-gradient(top, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.6) 70%, rgba(255, 255, 255, 0.98) 100%);
}
.info {
  position: relative;
  top: 10%;
  color: #fff;
  box-sizing: border-box;
  padding: 30px 40px 25px;
  margin: 180px auto 0;
  z-index: 40;
  background-color: rgba(0, 0, 0, 0.85);
  display: inline-block;
  -webkit-border-radius: 3px;
  -webkit-background-clip: padding-box;
  -moz-border-radius: 3px;
  -moz-background-clip: padding;
  border-radius: 3px;
  background-clip: padding-box;
}
.info h1 {
  font-weight: 600;
  margin: 0;
}
.info p {
  margin: 0.5em auto;
}
.info a {
  color: #fff;
}
.info .credit {
  font-size: 14px;
  margin-bottom: 0;
}
.info .btn {
  border: 2px solid #999;
  color: #999;
  text-decoration: none;
  font: 400 18px/1.5em 'Open Sans', sans-serif;
  padding: 5px 10px;
  -webkit-border-radius: 3px;
  -webkit-background-clip: padding-box;
  -moz-border-radius: 3px;
  -moz-background-clip: padding;
  border-radius: 3px;
  background-clip: padding-box;
  margin: 1em auto 0.5em;
  -webkit-transition: all 0s ease 0s;
  transition: all 0s ease 0s;
  -webkit-transition: all 300ms;
  transition: all 300ms;
  display: inline-block;
}
.info .btn + .btn {
  margin-left: 5px;
}
.info .btn:hover {
  border-color: #fff;
  color: #fff;
}
JS
/*********************************************************
* RandomUserWall | A random wall of faces
* Version:		1.0.0
* Author:		Mike Zarandona
*********************************************************/
(function(b,c){b.fn.randomUserWall=function(e){e=b.extend({},b.fn.randomUserWall.options,e);return this.each(function(){var f=[],m=[],k,j,n,h="";for(var g=0;g')}}else{if(e.gender=="male"){for(g=0;g')}}else{var l=false;do{j=Math.random()<0.5?false:true;if((j===false)&&(m.length>0)){b(this).append('');m.splice(0,1)}else{if((j===true)&&(f.length>0)){b(this).append('');f.splice(0,1)}}if((f.length===0)&&(m.length===0)){l=true}}while(l===false)}}})};function d(e){var f,g=100;totalNumberOfFemaleFaces=96;if(e===false){f=Math.floor(Math.random()*g)}else{if(e===true){f=Math.floor(Math.random()*totalNumberOfFemaleFaces)}else{console.error("RandomUserWall ERROR:  Thunk.")}}return f}function a(f,i,e,g,h){if(f===true){if(b.inArray(i,g)>=0){h=false}else{h=true;g.push(i)}return h}else{if(f===false){if(b.inArray(i,e)>=0){h=false}else{h=true;e.push(i)}return h}else{console.error("RandomUserWall Error:  Clunk.")}}}b.fn.randomUserWall.options={numFaces:0,gender:"",imgSize:""}})(jQuery);

// this comment is here to stop codepens insane indenting
$('.wall').randomUserWall({ numFaces: 98 });
Host Instantly Drag and Drop Website Builder

 

Description

A jQuery Plugin to build a wall of random user faces. https://github.com/mike-zarandona/RandomUserWall
Term
Mon, 11/27/2017 - 21:36

Related Codes

Pen ID
Pen ID
Pen ID