Layout resizing tweaks

This commit is contained in:
Marcin Kurczewski 2014-02-16 12:33:31 +01:00
parent 5148f9162d
commit e36498f709
5 changed files with 28 additions and 13 deletions

View file

@ -35,7 +35,8 @@ body {
} }
.main-wrapper { .main-wrapper {
margin: 0 1.5em; margin: 0 auto;
padding: 0 30px;
} }
@ -151,8 +152,8 @@ footer a {
#sidebar { #sidebar {
float: left; float: left;
width: 256px; width: 240px;
margin-right: 1em; margin-right: 15px;
} }
#sidebar h1 { #sidebar h1 {
margin-top: 0; margin-top: 0;

View file

@ -16,16 +16,15 @@
margin-bottom: 0; margin-bottom: 0;
} }
#content { #content .main-wrapper>* {
margin: 0 auto; margin: 0 auto;
width: 70%; width: 70%;
min-width: 500px;
position: relative; position: relative;
} }
.small-screen #content { @media only screen and (max-width:700px) {
#content .main-wrapper>* {
width: 100%; width: 100%;
min-width: 0; }
max-width: 500px;
} }
#content .body { #content .body {
@ -45,7 +44,7 @@
#content .footer { #content .footer {
font-size: small; font-size: small;
color: dimgray; color: dimgray;
margin: 0.5em 0 3em 0; margin: 0.5em auto 3em auto;
} }
#content .footer .left { #content .footer .left {
float: left; float: left;

View file

@ -1,11 +1,11 @@
.post { .post {
margin: 0.5em; margin: 8px;
} }
.posts-wrapper { .posts-wrapper {
text-align: center; text-align: center;
} }
.posts { .posts {
margin: 0 auto; margin: -8px auto 0 auto;
} }
.form-wrapper { .form-wrapper {

View file

@ -1,5 +1,4 @@
#sidebar { #sidebar {
width: 220px;
font-size: 90%; font-size: 90%;
} }

View file

@ -157,14 +157,30 @@ $(function()
{ {
$(window).resize(function() $(window).resize(function()
{ {
fixSize();
if ($('body').width() == $('body').data('last-width')) if ($('body').width() == $('body').data('last-width'))
return; return;
$('body').data('last-width', $('body').width()); $('body').data('last-width', $('body').width());
$('body').trigger('dom-update'); $('body').trigger('dom-update');
}); });
$('body').bind('dom-update', processSidebar); $('body').bind('dom-update', processSidebar);
fixSize();
}); });
var fixedEvenOnce = false;
function fixSize()
{
var multiply = 168;
var oldWidth = $('.main-wrapper:eq(0)').width();
$('.main-wrapper:eq(0)').width('');
var newWidth = $('.main-wrapper:eq(0)').width();
if (oldWidth != newWidth || !fixedEvenOnce)
{
$('.main-wrapper').width(multiply * Math.floor(newWidth / multiply));
fixedEvenOnce = true;
}
}
//autocomplete //autocomplete