Skip to content

Instantly share code, notes, and snippets.

@CombatCreative
Created September 21, 2014 02:40
Show Gist options
  • Save CombatCreative/838b07432419e3ebeed5 to your computer and use it in GitHub Desktop.
Save CombatCreative/838b07432419e3ebeed5 to your computer and use it in GitHub Desktop.
A Pen by Teegan.
<header>
<div class="logo">
Fat Pony
</div>
</header>
<section id="products">
<div class="row">
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
<div class="col-md-3 item">
<div class="overlay">
<i class="fa fa-search"></i>
</div>
</div>
</div>
</section>
$(document).ready(function(){
var $h = $(window).height();
var $w = $(window).width();
// Full screen sections
$('header').css({
"width": $w,
"height": $h
});
// Making .items square (height = width)
$('.item').css("height", $('.item').width());
// Centering Function
(function( $ ){
$.fn.center = function() {
var $top = (($(this).parent().height()/2)-($(this).height()/2));
var $left = (($(this).parent().width()/2)-($(this).width()/2));
$(this).css({
"position": "absolute",
"top": $top,
"left": $left
});
return this;
};
})( jQuery );
$('.logo').center();
$('.item i').center();
// Random Item background color
var colors = ["#999","#888","#777","#666","#555","#444","#333","#222","#111","#ccc"];
$('.item').each(function(){
var $rand = Math.floor(Math.random()*colors.length);
$(this).css("background-color", colors[$rand]);
});
$(window).resize(function(){
var $h = $(window).height();
var $w = $(window).width();
$('header').css({
"width": $w,
"height": $h
});
// Making .items square (height = width)
$('.item').css("height", $('.item').width());
(function( $ ){
$.fn.center = function() {
var $top = (($(this).parent().height()/2)-($(this).height()/2));
var $left = (($(this).parent().width()/2)-($(this).width()/2));
$(this).css({
"position": "absolute",
"top": $top,
"left": $left
});
return this;
};
})( jQuery );
$('.logo').center();
$('.item i').center();
});
});
$logo-font: "Cabin", sans-serif;
$easyfade: all 0.3s ease-in-out;
@mixin transition($animate) {
-webkit-transition: $animate;
-moz-transition: $animate;
-o-transition: $animate;
-ms-transition: $animate;
transition: $animate;
}
* {
box-sizing: border-box;
}
body {
width: 100%;
.row {
width: 100%;
margin: 0;
}
header {
background: -webkit-linear-gradient(90deg, #AA076B 10%, #61045F 90%); /* Chrome 10+, Saf5.1+ */
background: -moz-linear-gradient(90deg, #AA076B 10%, #61045F 90%); /* FF3.6+ */
background: -ms-linear-gradient(90deg, #AA076B 10%, #61045F 90%); /* IE10 */
background: -o-linear-gradient(90deg, #AA076B 10%, #61045F 90%); /* Opera 11.10+ */
background: linear-gradient(90deg, #AA076B 10%, #61045F 90%); /* W3C */
font-size: 12pt;
.logo {
border: 10px solid #fff;
color: #fff;
padding: 15px 30px;
display: inline-block;
text-transform: uppercase;
font-weight: 700;
font-size: 4em;
font-family: $logo-font;
text-shadow: 5px 1px 4px rgba(0,0,0,0.3);
box-shadow: 5px 1px 4px rgba(0,0,0,0.3);
}
}
#products {
.item {
color: #fff;
text-shadow: 5px 1px 4px rgba(0,0,0,0.3);
padding: 0;
overflow: hidden;
.overlay {
width: 100%;
height: 100%;
position: absolute;
top: -100%;
background: #000;
left: 0;
@include transition($easyfade);
i {
font-size: 4em;
}
}
}
.item:hover {
.overlay {
top: 0;
i {
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment