%header
%ul
%i{:class => 'fa fa-shopping-cart'}
%span.counter
.row
.product--blue
.product_inner
%img{:src => 'http://wellandgood.com/wp-content/uploads/2012/07/Nike-Free-30-Womens-Running-Shoe-511495_600_A.png', :width => '300'}
%p Nike Air (Women)
%p Size 7
%p Price £199.99
%button Add to basket
.product_overlay
%h2 Added to basket
%i{:class => 'fa fa-check'}
.product--orange
.product_inner
%img{:src => 'http://wellandgood.com/wp-content/uploads/2012/07/Nike-Free-30-Womens-Running-Shoe-511495_600_A.png', :width => '300'}
%p Nike Air (Men)
%p Size 10
%p Price £99.99
%button Add to basket
.product_overlay
%h2 Added to basket
%i{:class => 'fa fa-check'}
.product--red
.product_inner
%img{:src => 'http://wellandgood.com/wp-content/uploads/2012/07/Nike-Free-30-Womens-Running-Shoe-511495_600_A.png', :width => '300'}
%p Nike Air (Women)
%p Size 8
%p Price £399.99
%button Add to basket
.product_overlay
%h2 Added to basket
%i{:class => 'fa fa-check'}
.product--green
.product_inner
%img{:src => 'http://wellandgood.com/wp-content/uploads/2012/07/Nike-Free-30-Womens-Running-Shoe-511495_600_A.png', :width => '300'}
%p Nike Air (Men)
%p Size 11
%p Price £299.99
%button Add to basket
.product_overlay
%h2 Added to basket
%i{:class => 'fa fa-check'}
.product--yellow
.product_inner
%img{:src => 'http://wellandgood.com/wp-content/uploads/2012/07/Nike-Free-30-Womens-Running-Shoe-511495_600_A.png', :width => '300'}
%p Nike Air (Women)
%p Size 11
%p Price £299.99
%button Add to basket
.product_overlay
%h2 Added to basket
%i{:class => 'fa fa-check'}
.product--pink
.product_inner
%img{:src => 'http://wellandgood.com/wp-content/uploads/2012/07/Nike-Free-30-Womens-Running-Shoe-511495_600_A.png', :width => '300'}
%p Nike Air (Men)
%p Size 11
%p Price £299.99
%button Add to basket
.product_overlay
%h2 Added to basket
%i{:class => 'fa fa-check'}
View Compiled
// Variables
$bg-color: #EEE5E9;
$blue-card: #92DCE5;
$orange-card: #EF6F6C;
$red-card: #E84855;
$green-card: #70C1B3;
$yellow-card: #E8DB7D;
$pink-card: #FF386D;
// Mixins
@mixin diagBg($color) {
background: linear-gradient(-45deg, $color 50%, rgba(255, 255, 255, 0.5) 50%);
}
* {
margin: 0; padding: 0;
box-sizing: border-box;
font-family: 'Open Sans Condensed', sans-serif;
font-weight: 700;
}
html,body {
background: $bg-color;
}
header {
width: 95%;
display: flex;
justify-content: flex-end;
flex-flow: row wrap;
ul {
padding: 1.2em 0 0.5em;
}
span {
padding: 0 0 0 0.5em;
}
span, i {
color: #2B2D42;
}
i:nth-of-type(2) {
cursor: pointer;
}
}
.row {
width: 100%;
justify-content: flex-start;
display: flex;
flex-flow: row wrap;
}
.product {
box-shadow: 1px 5px 15px #CCC;
width: 15em;
height: auto;
border-radius: 3px;
padding: 2em;
margin: 1em;
overflow: hidden;
position: relative;
flex: auto;
&--blue {
@extend .product;
@include diagBg($blue-card);
}
&--orange {
@extend .product;
@include diagBg($orange-card);
}
&--red {
@extend .product;
@include diagBg($red-card);
}
&--green {
@extend .product;
@include diagBg($green-card);
}
&--yellow {
@extend .product;
@include diagBg($yellow-card);
}
&--pink {
@extend .product;
@include diagBg($pink-card);
}
img {
max-width: 100%;
height: auto !important;
text-align: center;
}
&_inner {
display: flex;
align-items: center;
flex-flow: column wrap;
p {
color: rgba(255, 255, 255, 0.9);
}
button {
border: 1px solid rgba(255, 255, 255, 0.5);
color: #FFF;
border-radius: 3px;
padding: 1em 3em;
margin: 1em 0 0 0;
background: none;
cursor: pointer;
transition: background ease-in .25s;
&:hover {
background: rgba(255, 255, 255, 1);
color: #2B2D42;
}
&:before {
font-family: FontAwesome;
content: '\f07A';
color: #FFF;
position: absolute;
font-size: 1.5em;
margin: 0 -1.5em;
}
&:hover:before {
color: #2B2D42;
}
}
}
&_overlay {
background: rgba(255, 255, 255, 0.9);
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
right: 0;
transform: translateY(-500px);
opacity: 0;
display: flex;
flex-flow: column wrap;
justify-content: center;
align-items: center;
h2 {
color: rgba(43, 45, 66, 0.7);
font-size: 1.2em;
margin: 1em 0;
}
i {
color: rgba(43, 45, 66, 0.7);
font-size: 1.5em;
}
}
}
View Compiled
$(function() {
"use strict"
var init = "No items yet!";
var counter = 0;
// Initial Cart
$(".counter").html(init);
// Add Items To Basket
function addToBasket() {
counter++;
$(".counter").html(counter).animate({
'opacity' : '0'
},300, function() {
$(".counter").delay(300).animate({
'opacity' : '1'
})
})
}
// Add To Basket Animation
$("button").on("click", function() {
addToBasket(); $(this).parent().parent().find(".product_overlay").css({
'transform': ' translateY(0px)',
'opacity': '1',
'transition': 'all ease-in-out .45s'
}).delay(1500).queue(function() {
$(this).css({
'transform': 'translateY(-500px)',
'opacity': '0',
'transition': 'all ease-in-out .45s'
}).dequeue();
});
});
});
This Pen doesn't use any external CSS resources.