From 6788be8993be3eeda910223d773afe29b63e2e2c Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Sun, 19 Oct 2014 13:12:11 +0200 Subject: [PATCH] Improved post search appearance on small screens --- public_html/css/post-list.css | 14 ++++++++++++-- public_html/js/Presenters/PostListPresenter.js | 3 +-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/public_html/css/post-list.css b/public_html/css/post-list.css index 82de7aed..7db2c1b0 100644 --- a/public_html/css/post-list.css +++ b/public_html/css/post-list.css @@ -3,16 +3,26 @@ } .post-list .search { - margin-bottom: 1em; + margin: 0 auto 1em auto; text-align: left; } +@media all and (min-width: 57em) { + .post-list .search { + min-width: 50em; + } +} +@media all and (max-width: 57em) { + .post-list .search { + min-width: 100%; + } +} .post-list .search:after { display: block; content: ''; clear: both; } .post-list .search input { - width: 20em; + max-width: 20em; } .post-list .search button { margin-left: 0.25em; diff --git a/public_html/js/Presenters/PostListPresenter.js b/public_html/js/Presenters/PostListPresenter.js index b1f500a5..c2e503c0 100644 --- a/public_html/js/Presenters/PostListPresenter.js +++ b/public_html/js/Presenters/PostListPresenter.js @@ -158,8 +158,7 @@ App.Presenters.PostListPresenter = function( if ($firstPost.length === 0) { return; } - $el.find('.search').css('margin-left', $firstPost.offset().left - $list.offset().left); - $el.find('.search').css('margin-right', $list.width() - ($lastPost.offset().left - $list.offset().left + $lastPost.width())); + $el.find('.search').width($lastPost.offset().left + $lastPost.width() - $firstPost.offset().left); } function postTagButtonClicked(e) {