From e36498f709e7a4d7d334606720a77ea3020d986b Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 16 Feb 2014 12:33:31 +0100 Subject: [PATCH] Layout resizing tweaks --- public_html/media/css/core.css | 7 ++++--- public_html/media/css/index-index.css | 13 ++++++------- public_html/media/css/post-list.css | 4 ++-- public_html/media/css/user-view.css | 1 - public_html/media/js/core.js | 16 ++++++++++++++++ 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/public_html/media/css/core.css b/public_html/media/css/core.css index 4b42f03b..b35e7049 100644 --- a/public_html/media/css/core.css +++ b/public_html/media/css/core.css @@ -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; diff --git a/public_html/media/css/index-index.css b/public_html/media/css/index-index.css index 6abf221f..024e96fc 100644 --- a/public_html/media/css/index-index.css +++ b/public_html/media/css/index-index.css @@ -16,16 +16,15 @@ margin-bottom: 0; } -#content { +#content .main-wrapper>* { margin: 0 auto; width: 70%; - min-width: 500px; position: relative; } -.small-screen #content { - width: 100%; - min-width: 0; - max-width: 500px; +@media only screen and (max-width:700px) { + #content .main-wrapper>* { + width: 100%; + } } #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; diff --git a/public_html/media/css/post-list.css b/public_html/media/css/post-list.css index abf10abf..50510653 100644 --- a/public_html/media/css/post-list.css +++ b/public_html/media/css/post-list.css @@ -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 { diff --git a/public_html/media/css/user-view.css b/public_html/media/css/user-view.css index a70ea43a..91d714d2 100644 --- a/public_html/media/css/user-view.css +++ b/public_html/media/css/user-view.css @@ -1,5 +1,4 @@ #sidebar { - width: 220px; font-size: 90%; } diff --git a/public_html/media/js/core.js b/public_html/media/js/core.js index 651eb649..6336c717 100644 --- a/public_html/media/js/core.js +++ b/public_html/media/js/core.js @@ -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