|
#1
![Old](images/bytesforall/statusicon/post_old.gif)
Nov 14, 2014, 11:12 AM
|
![Flynn's Avatar](image.php?s=b9923e672953bc58b541ce970faba4de&u=1&dateline=1256758545) |
|
|
3,768 posts · Oct 2008
Munich, Germany
|
|
Responsive Atahualpa
see How To pass Google's 'Mobile-Friendly Test' which contains the information in this thread
Here is a CSS fix to make Atahualpa responsive. If you have sidebars on the left you'd need the JavaScript below as well, or else the left sidebars will be above the main area when in mobile mode.
Adjust the values 767 (CSS) and 768 (JS, see below) to the viewport width at which you want the layout columns to align below each other:
Add the following CSS to "Add HTM/CSS Inserts" -> "CSS Inserts".
Code:
@media only screen and (max-width: 767px) {
table#layout,
table#layout > tbody,
table#layout > tbody > tr,
table#layout > tbody > tr > td,
table#layout > tr,
table#layout > tr > td,
table#layout td#header,
table#layout td#left,
table#layout td#left-inner,
table#layout td#middle,
table#layout td#right,
table#layout td#right-inner,
table#layout td#footer {
display: block;
}
table#layout > colgroup {
display: none;
}
div#wrapper,
td#middle {
width: auto;
}
}
.hentry img {
max-width: 100%;
height: auto !important;
display: block !important;
}
This should be all, if you have no left sidebars. It may work without the !important for .hentry img
To keep the main column on top, even with left sidebars:
Add the following to "Add HTM/CSS Inserts" -> "HTML Inserts: Body Bottom"
Code:
<script>
jQuery(document).ready(function($) {
if( $(window).width() < 768 ) {
// If any left sidebar exists
if ( $('#left').length || $('#left-inner').length ) {
$("#middle").detach().prependTo('#bodyrow');
}
}
});
</script>
This Javascript does not take into account browser resizing. This is only done once on page load.
The CSS is tested, the JS not. Let me know if it does not work.
This solution does not take care of thing like switching to a mobile menu, however the menu items should wrap.
Last edited by juggledad; Apr 20, 2015 at 05:37 AM.
Reason: Made CSS more specific so it doesn't affect other tables
|
#2
![Old](images/bytesforall/statusicon/post_old.gif)
Nov 14, 2014, 06:03 PM
|
![juggledad's Avatar](image.php?s=b9923e672953bc58b541ce970faba4de&u=675&dateline=1243595674) |
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
it mess up the default calender widget - you end up with one date per line.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#3
![Old](images/bytesforall/statusicon/post_old.gif)
Nov 15, 2014, 07:26 AM
|
![Flynn's Avatar](image.php?s=b9923e672953bc58b541ce970faba4de&u=1&dateline=1256758545) |
|
|
3,768 posts · Oct 2008
Munich, Germany
|
|
Quote:
Originally Posted by juggledad
it mess up the default calender widget - you end up with one date per line.
|
I made the CSS more specific
|
#4
![Old](images/bytesforall/statusicon/post_old.gif)
Nov 15, 2014, 09:27 AM
|
![juggledad's Avatar](image.php?s=b9923e672953bc58b541ce970faba4de&u=675&dateline=1243595674) |
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
That's better!!
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#5
![Old](images/bytesforall/statusicon/post_old.gif)
Dec 11, 2014, 11:03 AM
|
|
Didn't work for me?
I tried this, looked at my blog on the iphone, and nothing was different. Tried it with and without the Henry section.
I have no left sidebar, so I didn't include the javascript.
|
#6
![Old](images/bytesforall/statusicon/post_old.gif)
Jan 11, 2015, 10:15 PM
|
|
|
4 posts · Oct 2009
Auckland
|
|
ok, I added this code to http://profilepictures.co.nz... it did not seem to have an effect on iPhone and iPad display at all... it did though in a browser. How should handle resizing the banner?
|
#7
![Old](images/bytesforall/statusicon/post_old.gif)
Feb 18, 2015, 01:42 AM
|
|
Quote:
Originally Posted by Flynn
Add the following to "Add HTM/CSS Inserts" -> "HTML Inserts: Body Bottom"
Code:
<script>
jQuery(document).ready(function($) {
if( $(window).width() < 768 ) {
// If any left sidebar exists
if ( $('#left').length || $('#left-inner').length ) {
$("#middle").detach().prependTo('#bodyrow');
}
}
});
</script>
This Javascript does not take into account browser resizing. This is only done once on page load.
|
Without being able to account for a screen resize, it just didn't seem feasible to try and keep the left sidebar. So, I was playing around a bit and in order to account for a screen resize (such as a change in orientation on an iPad - or loading a page in a small browser window and then maximizing) this seems to work:
Code:
<script type="text/javascript">
function OnResizeDocument () {
if( window.innerWidth < 820 ) {
jQuery(function($) {
$("#middle").detach().prependTo('#bodyrow');
});
}
if( window.innerWidth > 820 ) {
jQuery(function($) {
$("#left").detach().prependTo('#bodyrow');
});
}
}
</script>
Adding that script to "HTML Inserts: Header" and adding this to the body tag ( "HTML Inserts: Body Tag"):
HTML Code:
<body onresize="OnResizeDocument()" >
Note: I'm using 820px instead of 768px in order to keep my nav bar from resizing.
The CSS adjustments are really, really nice! Thank you!
|
#8
![Old](images/bytesforall/statusicon/post_old.gif)
Mar 1, 2015, 06:47 PM
|
|
|
24 posts · Dec 2010
Eastern PA, USA
|
|
For those who are finding the CSS doesn't work on mobiles as is, try adding the following to the HTML Inserts: Header section:
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="initial-scale=1">
You'll also need these tags to make Google happy. Without them they will flag the site as "not mobile friendly" even though you have the media query in your CSS.
I'm not seeing a problem with comments on my test site, but there is only one post with a comment so far.
|
#9
![Old](images/bytesforall/statusicon/post_old.gif)
Mar 12, 2015, 07:25 AM
|
|
@sawyerjw
Thanks a lot for your reply. That was clearly missing. I got now 94 points on usability in google pagespeed insights.. (only some buttons to close to each user).
Adding to this - if you want to pass the google mobile test - you need to set the minimum page layout width to 320 pixels and no larger. Effectively something like 600 is much much better for real time use - but then it doesn't pass google tests - so that stays a bit a dilemma. At least for users with good eyes - 320 is really not good. So do it for google and blind people - or better optimize for real users??
Actually - how could one exclude the top navigation bar if viewport is smaller than X - say smaller than 600 pixels? (I use instead a menu in the right bar - which is moved down).
I got the comments fixed somehow now - but dunno why.
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org
Last edited by extremecarver; Mar 12, 2015 at 08:06 AM.
|
#10
![Old](images/bytesforall/statusicon/post_old.gif)
Mar 18, 2015, 10:36 AM
|
|
I am so happy! Thank you, Thank you, Thank you. Everything looks perfect and I have 2 left columns to deal with and comments are great.
Google test says: Awesome! This page is mobile-friendly.
|
#11
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 14, 2015, 09:35 AM
|
|
Quote:
Originally Posted by kayphoonstar
Adding that script to "HTML Inserts: Header" and adding this to the body tag ( "HTML Inserts: Body Tag"):
HTML Code:
<body onresize="OnResizeDocument()" >
|
Ouch - I finally found the bug in this one - Do not add the the smaller at the beginning "<" nor the ">" at the end - just:
Code:
body onresize="OnResize Document()"
is needed. Otherwise there will be an empty line introduced at the top... (and if you retry with Chrome - make sure to use incognito modus - I don't know at all but without fully resetting Chrome - chrome will run a bit havoc and sometimes not effect the changes - even though all others browsers work fine).
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org
|
#12
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 14, 2015, 09:56 AM
|
|
Well - so Overall I'm left with the following on PageSpeed (as probably anybody using Atahualpa):
Remove Render Blocking Scripts (one of which is by Atahualpa - the last:
https://openmtbmap.org/…-includes/js....js?ver=1.11.1
https://openmtbmap.org/…s/jquery/jqu...n.js?ver=1.2.1
https://openmtbmap.org/de/?bfa_ata_file=js
And of course loads of:
"Size tap targets appropriately"
Anyone got any good recommendations on how to manage the tap targets better?
Also it would be great to have some code to get rid of the Menu1 alltogether if viewport is smaller than 640 pixels (that should mean all smartphones - and maybe some tablets).
Mobilegeddon is just a few days away - and I am afraid that the tap targets are still a big showstopper - and I like most atahualpa users will even with the above changes lose a lot of search traffic from google.
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org
|
#13
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 16, 2015, 12:10 PM
|
|
What problems does google report for you?
Do you also have probs that the CSS is not working consistently and that the Sidebar from time to time is not actually removed but made smaller and detached but still there? (especially in Chrome - only Firefox is okay all the time for me).
If I don't find out why this sidebar problem exists - I will have to move to another theme before 21. April.
The Tap sizes are pretty much unsolvable for me - but it is possible to get to a rating that google stops complaining (if the sidebars vanish correctly - then usually 90-92 points on usability which is hopefully good enough). The rest is basically making sure it's speedy enough. I can get to 74-79 Points on Mobile Speed (95 points were possible if some third party plugins worked bettter) using ngx_pagespeed module and W3Total Cache (including minifying as well as possible).
Whats your domain?
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org
Last edited by juggledad; Apr 16, 2015 at 07:06 PM.
|
#14
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 16, 2015, 04:08 PM
|
|
My domain is normhamilton.ca
There is a single page site that provides entry to my photography, writing or blog.
There are no side bars on this page at all.
Google's Mobile-Friendly Test gives the following response.
Not mobile-friendly
Page appears not mobile-friendly
- Text too small to read
- Mobile viewport not set
- Links too close together
- Content wider than screen
UPDATE
As I was reading through Google's pages in the PageSpeed Insights I it suggested I configure a viewpoint, and gave a link to some instructions. I added the following to the Add HTML/CSS Inserts/HTML Inserts: Header
<meta name=viewport content="width=device-width, initial-scale=1">
It now says the site is mobile friendly. I'll have to see what happens now with the sites that have multiple plugins, e-commerce and a right side bar.
Last edited by yukoner; Apr 16, 2015 at 04:28 PM.
|
#15
![Old](images/bytesforall/statusicon/post_old.gif)
May 23, 2015, 08:57 PM
|
|
Quote:
Originally Posted by extremecarver
Ouch - I finally found the bug in this one - Do not add the the smaller at the beginning "<" nor the ">" at the end - just:
Code:
body onresize="OnResize Document()"
is needed. Otherwise there will be an empty line introduced at the top... (and if you retry with Chrome - make sure to use incognito modus - I don't know at all but without fully resetting Chrome - chrome will run a bit havoc and sometimes not effect the changes - even though all others browsers work fine).
|
Ouch, indeed! Thank you for pointing this out.
I also found another issue with this but I'm not sure when it started. I only discovered it when updating Atahualpa to 3.7.23 and WP to 4.2.2. I had a problem with pages where there is an input field on Android devices: the keyboard won't stay up because Android adjusts the screen size when the virtual keyboard pops up which then runs the 'onresize' function again and the input field loses focus and the keyboard disappears - it is an ugly loop. AFAIK, it's only Android. iOS doesn't exhibit the same issue.
At this point the only workaround I could get to work was to remove the left sidebar from any pages that have an input field and adding back the check for a left sidebar function:
Code:
if ( $('#left').length || $('#left-inner').length ) {
$("#middle").detach().prependTo('#bodyrow');
}
That seems to keep the 'onresize' function from firing and the keyboard stays up for text input.
Also, FWIW, I've switched to using the 'window.onresize' function in a separate file:
Code:
window.onresize = resize;
function resize(){
if( window.innerWidth < 820 ) {
jQuery(function($) {
// If any left sidebar exists
if ( $('td#left').length ) {
$("#middle").detach().prependTo('#bodyrow');
}});
} else
if( window.innerWidth > 820 ) {
jQuery(function($) {
// If any left sidebar exists
if ( $('td#left').length ) {
$("td#left").detach().prependTo('#bodyrow');
}});
}
}
...and put it directly into the functions.php file:
Code:
function resize_window()
{
wp_register_script( 'resize', get_template_directory_uri() . '/js/resize.js', array( 'jquery') );
wp_enqueue_script('resize');
}
add_action( 'wp_enqueue_scripts', 'resize_window' );
I hope this helps somebody. Cheers!
|
#16
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 17, 2015, 02:41 AM
|
|
|
59 posts · Jan 2010
Stamford, Lincs, England
|
|
Is there a fully responsive version of ATA coming soon?
|
#17
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 19, 2015, 06:29 PM
|
|
This works great on three of my sites, including a test site. Really pleased with that. However on two other sites, when viewed on a mobile, the site is limited in width to about 1/4 of the screen on my phone or doesn't move the sidebar below the main on my tablet. Text runs down left side instead of across the page. Any help is appreciated.
See Spirit Knives Yukon
I've been unable to locate what is causing the problem. I thought it might be the shopping cart, but it works OK on my test site with the shopping cart in place.
This is what I've put into the HTML/CSS Inserts (Everything has been cut and pasted from this thread)
HTML Inserts: Header
<meta name=viewport content="width=device-width, initial-scale=1">
HTML Inserts: Body Tag
body onresize="OnResize Document()"
HTML Inserts: Body Bottom
<script>
jQuery(document).ready(function($) {
if( $(window).width() < 768 ) {
// If any left sidebar exists
if ( $('#left').length || $('#left-inner').length ) {
$("#middle").detach().prependTo('#bodyrow');
}
}
});
</script>
CSS Inserts
/* Make Atahualpa Responsive */
@media only screen and (max-width: 767px) {
table#layout,
table#layout > tbody,
table#layout > tbody > tr,
table#layout > tbody > tr > td,
table#layout > tr,
table#layout > tr > td,
table#layout td#header,
table#layout td#left,
table#layout td#left-inner,
table#layout td#middle,
table#layout td#right,
table#layout td#right-inner,
table#layout td#footer {
display: block;
}
table#layout > colgroup {
display: none;
}
div#wrapper,
td#middle {
width: auto;
}
}
.hentry img {
max-width: 100%;
height: auto !important;
display: block !important;
}
Last edited by yukoner; Apr 19, 2015 at 11:00 PM.
Reason: Clarifying information.
|
#18
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 20, 2015, 12:43 AM
|
![juggledad's Avatar](image.php?s=b9923e672953bc58b541ce970faba4de&u=675&dateline=1243595674) |
|
|
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
|
|
@yukoner: You have a syntax error in your body statement and many syntax errors in your CSS Inserts
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
|
#19
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 20, 2015, 09:04 AM
|
|
Thanks Juggledad.
Do you mean errors in the what I'm adding here or something that was pre-existing before I added this?
|
#20
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 20, 2015, 10:28 AM
|
|
Dreams do come true! Thanks for making this happen!
|
#21
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 20, 2015, 07:10 PM
|
|
For some reason the only way I can find this suggestion from you was to quote another response from you. That said, this did the trick for Spirit Knives Yukon. Now on to the other site; it has a left sidebar. Thanks for this very helpful suggestion, Juggledad.
Quote:
Originally Posted by juggledad
You have at least one open bracket where you should have a close bracket
Do this, add the following to the very begining of the CSS Inserts
HTML Code:
body {
background-color: #00ffff;
background-image: none;
}
go look at the page - is the background a light blue? (it should be).
Now move that CSS to teh end of the CSS Inserts and go view the page. Is the background light blue? Probably not it you haven't fixed teh syntax errors, so move the code halfway up in the CSS Inserts to see if you can find the error. If it works, you know the error is in the bottom half of your CSS Inserts and keep repeating, if it doesn't then you know the error is in the toop haalf of the CSS inserts. Keep moving it and you can narrow down the issue and find and fix it.
|
|
#22
![Old](images/bytesforall/statusicon/post_old.gif)
Apr 21, 2015, 07:31 AM
|
|
Actually how can we remove the Top Menu if width smaller X?
Then we could use Responsive Menu instead - because the Menu really does not work well for mobile - but it would be a shame to use an Responsive menu on desktop too (not very quick for desktop and people do not look out for it!).
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org
|
|