LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

width:
font-size:
layout:
1
2
3
4
5
CSS
/******************
* Layout specific
*******************/
@media screen and (max-width: 699px) {
  body {
    min-width: 30rem;
    width: auto !important;
    width: 30rem;
    padding: 1rem;
  }
  body > section {
    width: 28rem;
  }
  body > section > div {
    width: 29rem;
  }
  body > section > div > div {
    width: 28rem;
  }
}
@media screen and (min-width: 700px) {
  body {
    min-width: 70rem;
    width: auto !important;
    width: 70rem;
    padding: 2rem;
  }
  body > section {
    width: 66rem;
  }
  body > section > div {
    width: 67rem;
  }
  body > section > div > div {
    height: 20rem;
  }
  body > section > div > div.small {
    width: 20rem;
  }
  body > section > div > div.medium {
    width: 45rem;
  }
  body > section > div > div.large {
    width: 66rem;
  }
}
/******************
* Basic CSS
*******************/
* {
  box-sizing: border-box;
}
body {
  overflow-x: hidden;
  background-color: #333;
  color: #fff;
  text-align: center;
}
body > section {
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  font-size: 0;
}
body > section > div > div {
  display: inline-block;
  margin: 0 1rem 1rem 0;
  background-color: #666;
  font-size: 10rem;
  line-height: 20rem;
}
#panel {
  z-index: 1;
  position: fixed;
  left: 10px;
  top: 10px;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.25);
  font-size: 14px;
  line-height: 21px;
  color: #000;
  border-radius: 8px;
}
#panel dl {
  margin: 0;
  padding: 0;
}
#panel dl dt,
#panel dl dd {
  float: left;
  margin: 0;
  padding: 0;
  text-align: left;
}
#panel dl dt {
  width: 76px;
  font-weight: bold;
}
#panel dl dd + dt {
  clear: both;
}
JS
// initialize REMux (no jQuery dependency)
var remux = window.qoopido.remux
    .addLayout({
      mobile: { width: 420, base: 14, min: 10, max: 23, breakpoint: 420 * (10 / 14) },
      desktop: { width: 980, base: 14, min: 10, max: 18, breakpoint: 980 * (10 / 14) }
    });

// Code for the info panel
var $window   = $(window),
    $panel    = $('#panel'),
    $width    = $('.width', $panel),
    $fontsize = $('.fontsize', $panel),
    $layout   = $('.layout', $panel),
    state     = remux.getState();

$width.html(state.width + 'px');
$fontsize.html(state.size.zoomed + 'px');
$layout.html(state.layout);

remux.on('ratiochange', function(state) {
  $width.html(state.width + 'px');
  $fontsize.html(state.size.zoomed + 'px');
});

remux.on('layoutchange', function(state) {
  $layout.html(state.layout);
});

Description

An REM-driven and JS based approach to responsive layouts which is to some degree able to scale the whole layout instead of switching to a different one or reordering elements.
Term
Tue, 11/28/2017 - 13:42

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv