LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

	

Cart

Total $39.96

Checkout

Go to cart page

CSS
/* -------------------------------- 

Primary style

-------------------------------- */
html * {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*, *:after, *:before {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  font-size: 100%;
  font-family: "PT Sans", sans-serif;
  color: #31353d;
  background-color: #eeeff7;
}
body.overflow-hidden {
  /* prevent 2 vertical scrollbars on ie and firefox when the cart is visible */
  overflow: hidden;
}

a {
  color: #435779;
  text-decoration: none;
}

img {
  max-width: 100%;
}

/* -------------------------------- 

Modules - reusable parts of our design

-------------------------------- */
.cd-container {
  /* this class is used to horizontally align the gallery of items */
  position: relative;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}
.cd-container::after {
  /* clearfix */
  content: '';
  display: table;
  clear: both;
}

.cd-img-replace {
  /* replace text with a background-image */
  display: inline-block;
  overflow: hidden;
  text-indent: 100%;
  white-space: nowrap;
}

/* -------------------------------- 

xheader 

-------------------------------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  height: 50px;
  width: 100%;
  background: #31353d;
  text-align: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
  z-index: 4;
}
@media only screen and (min-width: 1200px) {
  header {
    height: 80px;
  }
}

#logo {
  padding-top: 5px;
  /* delete this property if you don't want your logo to scale down on mobile devices */
  -webkit-transform: scale(0.8);
  -moz-transform: scale(0.8);
  -ms-transform: scale(0.8);
  -o-transform: scale(0.8);
  transform: scale(0.8);
}
@media only screen and (min-width: 1200px) {
  #logo {
    padding-top: 20px;
    position: absolute;
    /* logo left margin on Dekstop */
    left: 2.4em;
    top: 0;
    -webkit-transform: scale(1);
    -moz-transform: scale(1);
    -ms-transform: scale(1);
    -o-transform: scale(1);
    transform: scale(1);
  }
}

#cd-hamburger-menu, #cd-cart-trigger {
  position: absolute;
  top: 0;
  height: 100%;
}
#cd-hamburger-menu a, #cd-cart-trigger a {
  width: 60px;
  height: 100%;
}

#cd-hamburger-menu {
  left: 0;
}
#cd-hamburger-menu a {
  background: #26292f url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/148866/cd-hamburger-menu.svg") no-repeat center center;
}
@media only screen and (min-width: 1200px) {
  #cd-hamburger-menu {
    display: none;
  }
}

#cd-cart-trigger {
  right: 0;
}
#cd-cart-trigger a {
  background: #26292f url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/148866/cd-cart.svg") no-repeat center center;
}
@media only screen and (min-width: 1200px) {
  #cd-cart-trigger {
    /* cart right margin on desktop */
    right: 0;
  }
  #cd-cart-trigger a {
    position: relative;
    width: 100px;
    border-left: none;
    background-color: #26292f;
  }
}

#main-nav, #cd-cart {
  position: fixed;
  top: 0;
  height: 100%;
  width: 260px;
  /* header height */
  padding-top: 50px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  z-index: 3;
}
@media only screen and (min-width: 768px) {
  #main-nav, #cd-cart {
    width: 350px;
  }
}
@media only screen and (min-width: 1200px) {
  #main-nav, #cd-cart {
    width: 30%;
    /* header height has changed */
    padding-top: 80px;
  }
}

#main-nav {
  left: -100%;
  background: #FFF;
  -webkit-transition: left 0.3s;
  -moz-transition: left 0.3s;
  transition: left 0.3s;
}
#main-nav.speed-in {
  left: 0;
}
#main-nav ul a {
  display: block;
  height: 50px;
  line-height: 50px;
  padding: 0 1em;
  border-bottom: 1px solid #e0e6ef;
}
#main-nav ul .current {
  box-shadow: inset 3px 0 #435779;
}
@media only screen and (min-width: 1200px) {
  #main-nav {
    /* reset main nav style */
    position: absolute;
    height: auto;
    width: auto;
    left: auto;
    right: 8em;
    padding-top: 0;
    top: 0;
    background: transparent;
    box-shadow: none;
    /* header height */
    line-height: 80px;
    z-index: 4;
  }
  #main-nav li {
    display: inline-block;
    margin-left: 1em;
  }
  #main-nav ul a {
    display: inline-block;
    height: auto;
    line-height: 1;
    padding: 1em 1.4em;
    border-bottom: none;
    color: rgba(255, 255, 255, 0.8);
    border-radius: 0.25em;
  }
  #main-nav ul a.current {
    box-shadow: none;
    background: #435779;
    color: #FFF;
  }
  .no-touch #main-nav ul a:hover {
    background: #435779;
    color: #FFF;
  }
}
.no-js #main-nav {
  position: fixed;
}

#cd-cart {
  right: -100%;
  background: #FFF;
  -webkit-transition: right 0.3s;
  -moz-transition: right 0.3s;
  transition: right 0.3s;
}
#cd-cart.speed-in {
  right: 0;
}
#cd-cart > * {
  padding: 0 1em;
}
#cd-cart h2 {
  font-size: 14px;
  font-size: 0.875rem;
  font-weight: bold;
  text-transform: uppercase;
  margin: 1em 0;
}
#cd-cart .cd-cart-items {
  padding: 0;
}
#cd-cart .cd-cart-items li {
  position: relative;
  padding: 1em;
  border-top: 1px solid #e0e6ef;
}
#cd-cart .cd-cart-items li:last-child {
  border-bottom: 1px solid #e0e6ef;
}
#cd-cart .cd-qty, #cd-cart .cd-price {
  color: #a5aebc;
}
#cd-cart .cd-price {
  margin-top: .4em;
}
#cd-cart .cd-item-remove {
  position: absolute;
  right: 1em;
  top: 50%;
  bottom: auto;
  -webkit-transform: translateY(-50%);
  -moz-transform: translateY(-50%);
  -ms-transform: translateY(-50%);
  -o-transform: translateY(-50%);
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/148866/cd-remove-item.svg") no-repeat center center;
}
.no-touch #cd-cart .cd-item-remove:hover {
  background-color: #e0e6ef;
}
#cd-cart .cd-cart-total {
  padding-top: 1em;
  padding-bottom: 1em;
}
#cd-cart .cd-cart-total span {
  float: right;
}
#cd-cart .cd-cart-total::after {
  /* clearfix */
  content: '';
  display: table;
  clear: both;
}
#cd-cart .checkout-btn {
  display: block;
  width: 100%;
  height: 60px;
  line-height: 60px;
  background: #7dcf85;
  color: #FFF;
  text-align: center;
}
.no-touch #cd-cart .checkout-btn:hover {
  background: #a2dda8;
}
#cd-cart .cd-go-to-cart {
  text-align: center;
  margin: 1em 0;
}
#cd-cart .cd-go-to-cart a {
  text-decoration: underline;
}
@media only screen and (min-width: 1200px) {
  #cd-cart > * {
    padding: 0 2em;
  }
  #cd-cart .cd-cart-items li {
    padding: 1em 2em;
  }
  #cd-cart .cd-item-remove {
    right: 2em;
  }
}

/* -------------------------------- 

xgallery 

-------------------------------- */
main {
  position: relative;
  min-height: 100%;
  background: #eeeff7;
  padding-top: 70px;
  z-index: 1;
}
@media only screen and (min-width: 768px) {
  main {
    padding-top: 90px;
  }
}
@media only screen and (min-width: 1200px) {
  main {
    padding-top: 120px;
  }
}

#cd-gallery-items li {
  margin-bottom: 1.5em;
}
#cd-gallery-items li img {
  width: 100%;
  display: block;
  border-radius: 0.25em;
}
@media only screen and (min-width: 768px) {
  #cd-gallery-items li {
    width: 48%;
    float: left;
    margin-bottom: 2em;
    margin-right: 4%;
  }
  #cd-gallery-items li:nth-child(2n) {
    margin-right: 0;
  }
}
@media only screen and (min-width: 1200px) {
  #cd-gallery-items li {
    width: 31%;
    float: left;
    margin-bottom: 2.5em;
    margin-right: 3.5%;
  }
  #cd-gallery-items li:nth-child(2n) {
    margin-right: 3.5%;
  }
  #cd-gallery-items li:nth-child(3n) {
    margin-right: 0;
  }
}

#cd-shadow-layer {
  position: fixed;
  min-height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  background: rgba(67, 87, 121, 0.6);
  cursor: pointer;
  z-index: 2;
  display: none;
}
#cd-shadow-layer.is-visible {
  display: block;
  -webkit-animation: cd-fade-in 0.3s;
  -moz-animation: cd-fade-in 0.3s;
  animation: cd-fade-in 0.3s;
}

/* -------------------------------- 

xkeyframes 

-------------------------------- */
@-webkit-keyframes cd-fade-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@-moz-keyframes cd-fade-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
@keyframes cd-fade-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
JS
jQuery(document).ready(function($){
	//if you change this breakpoint in the style.css file (or _layout.scss if you use SASS), don't forget to update this value as well
	var $L = 1200,
		$menu_navigation = $('#main-nav'),
		$cart_trigger = $('#cd-cart-trigger'),
		$hamburger_icon = $('#cd-hamburger-menu'),
		$lateral_cart = $('#cd-cart'),
		$shadow_layer = $('#cd-shadow-layer');

	//open lateral menu on mobile
	$hamburger_icon.on('click', function(event){
		event.preventDefault();
		//close cart panel (if it's open)
		$lateral_cart.removeClass('speed-in');
		toggle_panel_visibility($menu_navigation, $shadow_layer, $('body'));
	});

	//open cart
	$cart_trigger.on('click', function(event){
		event.preventDefault();
		//close lateral menu (if it's open)
		$menu_navigation.removeClass('speed-in');
		toggle_panel_visibility($lateral_cart, $shadow_layer, $('body'));
	});

	//close lateral cart or lateral menu
	$shadow_layer.on('click', function(){
		$lateral_cart.removeClass('speed-in');
		$menu_navigation.removeClass('speed-in');
		$shadow_layer.removeClass('is-visible');
		$('body').removeClass('overflow-hidden');
	});

	//move #main-navigation inside header on laptop
	//insert #main-navigation after header on mobile
	move_navigation( $menu_navigation, $L);
	$(window).on('resize', function(){
		move_navigation( $menu_navigation, $L);
		
		if( $(window).width() >= $L && $menu_navigation.hasClass('speed-in')) {
			$menu_navigation.removeClass('speed-in');
			$shadow_layer.removeClass('is-visible');
			$('body').removeClass('overflow-hidden');
		}

	});
});

function toggle_panel_visibility ($lateral_panel, $background_layer, $body) {
	if( $lateral_panel.hasClass('speed-in') ) {
		$lateral_panel.removeClass('speed-in');
		$background_layer.removeClass('is-visible');
		$body.removeClass('overflow-hidden');
	} else {
		$lateral_panel.addClass('speed-in');
		$background_layer.addClass('is-visible');
		$body.addClass('overflow-hidden');
	}
}

function move_navigation( $navigation, $MQ) {
	if ( $(window).width() >= $MQ ) {
		$navigation.detach();
		$navigation.appendTo('header');
	} else {
		$navigation.detach();
		$navigation.insertAfter('header');
	}
}
Host Instantly Drag and Drop Website Builder

 

Description

This responsive animated side cart is a smart and not obtrusive way to let users jump in and out from the list of products they want to buy, without having to refresh the page or fire a popup.
Term
Mon, 11/27/2017 - 21:41

Related Codes

Pen ID
Pen ID
Pen ID