godoc: fix inline playground width for mobile devices

The inline playground had a fixed width due to which it gets partially
hidden on mobile devices. Hence, expanding the div to fit the entire
screen properly inside the media query for mobile resolutions.

Also, since the playground appears on top of the button, there is
no way to hide it except to reload the page. So, added a click handler
on the page to hide the playground if it is open.

Fixes golang/go#21636

Change-Id: Id15caec25e870e9ff3be7736e2bb1084591d1016
Reviewed-on: https://go-review.googlesource.com/c/129435
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Agniva De Sarker 2018-08-15 18:08:08 +05:30 committed by Andrew Bonventre
parent 3bba456143
commit 4fd3307906
3 changed files with 16 additions and 2 deletions

View File

@ -150,6 +150,15 @@ function setupDropdownPlayground() {
div.hide();
});
$('#menu').css('min-width', '+=60');
// Hide inline playground if we click somewhere on the page.
// This is needed in mobile devices, where the "Play" button
// is not clickable once the playground opens up.
$("#page").click(function() {
if (button.hasClass('active')) {
button.click();
}
});
}
function setupInlinePlayground() {

File diff suppressed because one or more lines are too long

View File

@ -763,6 +763,11 @@ a.error {
font-size: 0.9375rem;
}
div#playground {
left: 0;
right: 0;
}
pre,
code {
font-size: 0.866rem;