window.getSize() on android

108 views
Skip to first unread message

snillo

unread,
Jan 23, 2014, 1:02:34 PM1/23/14
to mootool...@googlegroups.com
Hi,

did anyone else had problems with window.getSize() on Android devices? 
If i hold my tablet in landscape mode, i get a wrong width. In portrait mode the width is correct.
Using window.innerWidth works in both cases. 
I have no meta tag for viewport configuration, website is with HTML5 doctype.

Georg

snillo

unread,
Jan 25, 2014, 10:22:30 AM1/25/14
to mootool...@googlegroups.com
i forgot; i'm using mootools 1.4.5, i'm calling window.getSize() on domready. The tablet is a Nexus 7 (browser = chrome), i have the same behaviour on my Samsung S2 (standart browser android 4.1)

haz...@gmail.com

unread,
Jan 28, 2014, 5:11:38 PM1/28/14
to mootool...@googlegroups.com

I'm sorry, I can not assist you as I do not own an Android device.



From: Georg.Sc...@gmail.com<Georg.Sc...@gmail.com>
To: <mootool...@googlegroups.com>
Sent: Saturday, January 25, 2014
Subject: [Moo] Re: window.getSize() on android
--

---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

shoplifter

unread,
Jan 29, 2014, 9:12:00 AM1/29/14
to mootool...@googlegroups.com
Hi, maybe you can try tu use an orientation change (or onResize) event to trigger getSize()?

snillo

unread,
Jan 30, 2014, 7:55:00 AM1/30/14
to mootool...@googlegroups.com
Hi,

i think the problem is not the orientation change or the "resize". Also when loading the page in landscape mode, getSize leads to wrong dimensions.

davepilbeam

unread,
Feb 4, 2014, 4:51:43 AM2/4/14
to mootool...@googlegroups.com

Hi,

there doesn't seem to be a problem with screen rotation and getSize() on an S2 (android 4.1.2 chrome browser) - http://jsfiddle.net/davepilbeam/jzP7F/ displays as expected in any orientation

are you using any responsive css? I found recently that measuring the viewport with any js (including getSize) before my responsive css gave me wrong co-ordinates in mobile chrome android..

Dave

snillo

unread,
Feb 4, 2014, 5:12:35 AM2/4/14
to mootool...@googlegroups.com
Hi Dave,

thanks for your js fiddle. i obtain correct dimensions on my nexus 7 (chrome browser) as well. So as you said propably i get the wrong dimensions because of my html / css structure, not sure why but at least it seems that it isn't a bug in mootools.
I solved my issue by querying for android devices ...

Georg
Reply all
Reply to author
Forward
0 new messages