-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: x/tools/present: make CSS responsive for mobile #21643
Comments
Thanks, @carlmjohnson. We definitely need to revisit the slides template. Let me look into it and will let you know about helping out. |
Actually, could you outline how you would want to change things in this bug? That way you can get started faster :) |
I've only started to look at the present HTML/JS/CSS, so I'm not sure how totally gnarly it is, but assuming it's tractable, I should be able to add a viewport meta and switch things away from height/width: 100% to 100vh/vw and see how close that gets me to the goal of just having slides fit in the window. |
After some quick local experiments, I think one simple thing to do is just add |
So this is pretty hacky, but it seems to make present at least fit into the window on mobile: @media(max-width: 1300px) {
.slides {
transform: scale(1);
-webkit-transform: scale(1);
}
}
@media(max-width: 1200px) {
.slides {
transform: scale(0.92);
-webkit-transform: scale(0.92);
}
}
@media(max-width: 1100px) {
.slides {
transform: scale(0.85);
-webkit-transform: scale(0.85);
}
}
@media(max-width: 1000px) {
.slides {
transform: scale(0.77);
-webkit-transform: scale(0.77);
}
}
@media(max-width: 900px) {
.slides {
transform: scale(0.69);
-webkit-transform: scale(0.69);
}
}
@media(max-width: 800px) {
.slides {
transform: scale(0.62);
-webkit-transform: scale(0.62);
}
}
@media(max-width: 700px) {
.slides {
transform: scale(0.54);
-webkit-transform: scale(0.54);
}
}
@media(max-width: 600px) {
.slides {
transform: scale(0.46);
-webkit-transform: scale(0.46);
}
} I'll open a CL once I get a chance, but I thought I'd add the comment here first in case that's too hacky to accept. |
Hmm, it would probably also be possible to do this as JS, which would make the scaling factor more precise and avoid repetition. I'll investigate. |
I’m not familiar with this code (though I am very familiar with frontend dev), so can you elaborate on what the problem is alongside any possible solutions? This will help us evaluate whether the approach is sound or if another should be investigated. |
Change line 476 of slides.js to this: scaleSmallViewports();
window.addEventListener('resize', scaleSmallViewports, false);
};
function scaleSmallViewports() {
if (window.innerWidth < 1300) {
document.querySelector('.slides').style.transform = 'scale(' +
window.innerWidth/1300.0 + ')';
} else {
document.querySelector('.slides').style.transform = '';
}
} Works pretty well. The downside of this code is it might fire too often when someone resizes their window. I can play around with that tonight. |
With |
Change https://golang.org/cl/60270 mentions this issue: |
Change https://golang.org/cl/95675 mentions this issue: |
Updates golang/go#21643 Change-Id: Ic662ac6ca152d8cf702b02651f55936a29a2e234 Reviewed-on: https://go-review.googlesource.com/95675 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
On mobile and tablets, it was very difficult to view slides because the slides were not designed to be smaller than 1250x750. This adds a function to the JS that uses CSS scaling to make the slides fit on smaller displays. Fixes golang/go#21643 Change-Id: I68e9e2c1274aaf6396bf01d19ca023cddf76e2ec Reviewed-on: https://go-review.googlesource.com/60270 Reviewed-by: Andrew Bonventre <andybons@golang.org> Reviewed-by: Francesc Campoy Flores <campoy@golang.org> Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Francesc Campoy Flores <campoy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
I often follow links to present slides from my phone, only to be frustrated with the difficulty of reading the slides from my phone. I propose redoing the CSS for mobile. I am willing to volunteer to do the work if I get approval to work on it.
The text was updated successfully, but these errors were encountered: