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 {
margin: 0 1.5em;
margin: 0 auto;
padding: 0 30px;
}
@ -151,8 +152,8 @@ footer a {
#sidebar {
float: left;
width: 256px;
margin-right: 1em;
width: 240px;
margin-right: 15px;
}
#sidebar h1 {
margin-top: 0;

View file

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

View file

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

View file

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

View file

@ -157,14 +157,30 @@ $(function()
{
$(window).resize(function()
{
fixSize();
if ($('body').width() == $('body').data('last-width'))
return;
$('body').data('last-width', $('body').width());
$('body').trigger('dom-update');
});
$('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