diff --git a/static/css/base.css b/static/css/base.css index 8bb6bce65..a38a1573b 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -587,6 +587,21 @@ span.party_header { padding-right: 20px; } .sortHeader { text-align:middle; padding-top: 3px; } .voteHeader { font-size: 19px; float: left; padding-right: 30px; text-align: middle; } #voteList { margin-top: 15px; width: 100%; min-width: 1100px; } + +/* voteTable.js picks 1-4 columns based on how many members are listed + (see .columns1-4 above), sized for desktop. Below the point where a + phone can't show even 2 of those columns at a readable width, force + a single column instead -- the alternative is a several-times-too-wide + layout that only reads normally after the user pinches out to see the + cut-off columns, which is what actually made the text look "tiny". */ +@media (max-width: 767px) { + #voteList { min-width: 0; } + .voteTable.columns2, + .voteTable.columns3, + .voteTable.columns4 { + columns: 1; + } +} #vote_chart_float { position: static; padding-bottom: 20px; } #vote_chart_float .saveButton { margin-left: 5px; font-size: 18px; vertical-align: middle; cursor: pointer; color: black; } #vote_chart_float .xlsButton { margin-left: 5px; width: 22px; vertical-align: middle; } diff --git a/static/js/voteCharts.js b/static/js/voteCharts.js index 63f6e6fec..a5fabb8eb 100644 --- a/static/js/voteCharts.js +++ b/static/js/voteCharts.js @@ -597,7 +597,20 @@ function drawWidgets(error, data, geodata, usaboundaries) } }); - $("#vote_chart_float").delay(500).stick_in_parent(); + // Only stick the vote-count chart to the viewport when its column sits + // beside the vote list (Bootstrap's md breakpoint, >=992px). Below that + // the columns stack, so a "stuck" full-width chart would end up pinned + // on top of the vote list underneath it as the page scrolls. + function updateVoteChartSticky() { + var $float = $("#vote_chart_float"); + if ($(window).width() >= 992) { + if (!$float.data("sticky_kit")) { $float.stick_in_parent(); } + } else if ($float.data("sticky_kit")) { + $float.trigger("sticky_kit:detach"); + } + } + $(window).on("resize", updateVoteChartSticky); + setTimeout(updateVoteChartSticky, 500); }