Misc CSS tweaks

This commit is contained in:
Marcin Kurczewski 2014-01-06 19:25:27 +01:00
parent 56622b8e9d
commit 1fcced20f1
3 changed files with 29 additions and 29 deletions

View file

@ -152,7 +152,7 @@ footer a {
#sidebar { #sidebar {
float: left; float: left;
width: 256px; width: 256px;
margin-right: 2em; margin-right: 1em;
} }
#sidebar h1 { #sidebar h1 {
margin-top: 0; margin-top: 0;
@ -174,29 +174,36 @@ footer a {
padding-bottom: 2em; padding-bottom: 2em;
} }
.small-screen #sidebar { .unit {
float: none; padding: 1em;
width: 100%;
padding: 0 0 1em 0;
}
.small-screen #inner-content {
float: none;
width: auto;
}
.bottom-unit {
padding: 0.5em 1em;
border: 1px solid #eee; border: 1px solid #eee;
margin: 1em 0;
}
#inner-content .unit {
border-bottom: 0; border-bottom: 0;
padding-bottom: 0; padding-bottom: 0;
margin: 1em 0 2em 0;
} }
.left-unit { #sidebar .unit {
margin: 0 0 1.5em 0;
padding: 0.75em;
border: 1px solid #eee;
padding-left: 0;
border-left: 0; border-left: 0;
padding-left: 0;
}
#small-screen { display: none; }
@media only screen and (max-width:700px) {
#small-screen { display: block; }
body #sidebar {
float: none;
width: 100%;
}
body #sidebar .unit {
border: 1px solid #eee;
border-bottom: 0;
padding: 1em 1em 0 1em;
}
#inner-content {
float: none;
width: auto;
}
} }

View file

@ -148,19 +148,10 @@ $(function()
//modify DOM on small viewports //modify DOM on small viewports
function processSidebar() function processSidebar()
{ {
$('#inner-content .unit').addClass('bottom-unit'); if ($('#small-screen').is(':visible'))
if ($('body').width() < 600)
{
$('body').addClass('small-screen');
$('#sidebar').insertAfter($('#inner-content')); $('#sidebar').insertAfter($('#inner-content'));
$('#sidebar .unit').removeClass('left-unit').addClass('bottom-unit');
}
else else
{
$('body').removeClass('small-screen');
$('#sidebar').insertBefore($('#inner-content')); $('#sidebar').insertBefore($('#inner-content'));
$('#sidebar .unit').removeClass('bottom-unit').addClass('left-unit');
}
} }
$(function() $(function()
{ {

View file

@ -73,5 +73,7 @@
$('body').trigger('dom-update'); $('body').trigger('dom-update');
}); });
</script> </script>
<div id="small-screen"></div>
</body> </body>
</html> </html>